Process and java classes
Hi...
My Bpel process accesses some java objects..To keep classes and projects separate I am keepin these classes in a war/ear and deploying it on oc4j...do u think the process can access the java classes in .war file..
I know i can have the java classes along with process source and copy the libs in BPEL-INF/lib but was trying to keep the code separate..
The process when compiled and built is packaged into .jar archive ..If we can drop this jar in an .ear package and deploy it probablythen the process can access the java classes..Can I access samples for the same?..
Thanks
Bhupinder
I don't believe you can access java objects from a war/ear, at least I wasn't able to get it working.
We have been jar'ing the objects up and placing them in C:\OraBPELPM_1\integration\orabpel\system\appserver\oc4j\j2ee\home\applib where the apps server can find them.
Toby
Similar Messages
-
(261680070) Q SYNCH-11 How do my web service methods accees EJBs and java classes?
A<SYNCH-11> How do my web service methods accees EJBs and java classes?
A<SYNCH-11> It is simple to use java classes, just do it as you would ordinarily.
The .jws file really contains a simple class so you can program with it in the same
way that you would use a regular Java class.
To use an EJB you can go and access it directly as you would with any EJB remote
client (lookup home stub, create, etc) or if the EJB is deployed to WLS you can use
a control to provide a very simple wrapper to the EJB. We will see this in detail
on Thursday in the ADVC module.Futher information about the possibility of callback:
It may be possible for a synchronous only web service (i.e. MS .net) to even paticipant
in the callback functionality of asynchronous web services. If the client implements
the appropriate methods for the callback but listens for them on a different port
or binding than the SOAP request, then web service may be able to build a response
if the client's "callback URL" is submitted as the beginning part of a conversation.
Watch the BEA developer forum (http://dev2dev.bea.com) for more information about
this approach and other tips and techniques for building web services.
"Adam FitzGerald" <[email protected]> wrote:
>
Q<SYNCH-03> I heard that MS .net only implements synchrnonus method? If
this is true.
Does it means my async methods will only work with J2EE clients?
A<SYNCH-03> I do not know the limitations of .net but let me point out that
is very
difficult to provide asynchronous web service method invocation (this is
different
from an asynchronous web service). HTTP as a general communication protocol
is based
on a request and response paradigm so your client libraries will mostly
likely be
expecting a response even if it is empty (check the asynchronous example
from today
to see that the start method still returns an empty response). You must
distinguish
this from the notion of an asynchronous web service which is a business
operation
that occurs on the server whose return value/result is not directly associated
with
building response to the client. An asynchronous web service can (and generally
will)
be started and stopped with web service operations that are invoked synchronously.
Thus MS .net clients can still be client to WLS hosted web services. -
JSP, Servlet, and Java Classes location in Tomcat
In tomcat, I want to know JSP files, Servlets, and Java classes
should put in different locations:
I put web.xml in the following:
C:\jakarta-tomcat-4.1.30\webapps\proj1\WEB-INF
I put all JSP files in the following:
C:\jakarta-tomcat-4.1.30\webapps\proj1
I put all servlet files in the following:
C:\jakarta-tomcat-4.1.30\webapps\proj1\WEB-INF\classes
I put all Java classes in the following with package proj1:
C:\jakarta-tomcat-4.1.30\webapps\proj1\WEB-INF\classes\proj1
When I execute JSP files, it has HTTP error 404, file not found.
The content of web.xml is:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>proj1</display-name>
<description>
proj1
</description>
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
Please advise. thanks!!!<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>Where's the servlet definition that maps to "invoker"? -
Deploying the JSPs, Servlets and Java class files
Hello All,
I'm very new to the Oracle 9i AS. We are using Version 1.0.2.2.
How do we deploy the JSPs, Servlets, and Java class files (simple class files, not EJBs)?
plese give us the procedure and stpes how to deply or the links for the same.
Thanks,
Santhosh.Hi
I guess u r running apache-jserv as servlet engine for your jsp and servlets. If its so, jsp files can be run without any additonal configuration by putting the jsp file under document root or any subdirectory and for running servlets u have to add classpath entries for your servlet in jserv.properties file.
To make sure that your servlet engine is working, try
http://servername:port/servlet/IsItWorking, if u get success msg that means servlet engine is working fine.
Hope this will help
Regards
Kumaran -
Invoking a BPEL Process from Java Class
Hi All,
I am new to BPEL. I am trying to invoke a BPEL Process using Java.
This following is the Oracle AS Home : D:\product\10.1.3.1\OracleAS_1
Credentials to access the default BPEL domain :
username - oc4jadmin
password - oc4jadmin
RMI Port in Oracle AS - 12401
(code)
import com.oracle.bpel.client.Locator;
import com.oracle.bpel.client.dispatch.IDeliveryService;
import com.oracle.bpel.client.NormalizedMessage;
import java.util.Hashtable;
import java.util.Map;
import javax.naming.Context;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
public class Class1 {
public static void main(String[] args) {
try {
Hashtable jndi = new Hashtable();
jndi.put(Context.PROVIDER_URL, "ormi://localhost:12401/orabpel");
jndi.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
jndi.put(Context.SECURITY_PRINCIPAL, "oc4jadmin");
jndi.put(Context.SECURITY_CREDENTIALS, "oc4jadmin");
jndi.put("dedicated.connection", "true");
Locator locator = new Locator("default", "oc4jadmin", jndi);
System.out.println( "check 1" );
IDeliveryService deliveryService = (IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME );
System.out.println( "check 2" );
String xml = "<ssn xmlns=\"http://services.otn.com\" >111222333</ssn>";
NormalizedMessage nm = new NormalizedMessage( );
nm.addPart("payload", xml );
System.out.println( "check 3" );
NormalizedMessage res = deliveryService.request("CreditRatingService","process",nm);
System.out.println( "check 4" );
System.out.println( "BPELProcess CreditRatingService executed!" );
Map payload = res.getPayload();
Element part = (Element)payload.get("payload");
Node outputElement = part.getFirstChild();
System.out.println("Rating: " + outputElement.getNodeValue());
catch (Exception ex) {
ex.printStackTrace();
(code)
When I run this, I get the following exception :
D:\JDeveloper\jdk\bin\javaw.exe -client -classpath D:\JDeveloper\jdev\mywork\mywork\test_bpel_java\ViewController\classes;D:\JDeveloper\jakarta-struts\lib\struts.jar;D:\JDeveloper\jakarta-struts\lib\commons-beanutils.jar;D:\JDeveloper\jakarta-struts\lib\commons-collections.jar;D:\JDeveloper\jakarta-struts\lib\commons-fileupload.jar;D:\JDeveloper\jakarta-struts\lib\commons-digester.jar;D:\JDeveloper\jakarta-struts\lib\commons-lang.jar;D:\JDeveloper\jakarta-struts\lib\commons-logging.jar;D:\JDeveloper\jakarta-struts\lib\commons-validator.jar;D:\JDeveloper\jakarta-struts\lib\jakarta-oro.jar;D:\JDeveloper\j2ee\home\lib\ojsp.jar;D:\JDeveloper\j2ee\home\jsp\lib\taglib\ojsputil.jar;D:\JDeveloper\j2ee\home\oc4j.jar;D:\JDeveloper\j2ee\home\lib\oc4j-internal.jar;D:\JDeveloper\j2ee\home\lib\servlet.jar;D:\JDeveloper\jdev\lib\ojc.jar;D:\product\10.1.3.1\OracleAS_1\bpel\lib\orabpel.jar view.Class1
check 1
check 2
check 3
Mar 22, 2011 11:04:07 PM oracle.j2ee.rmi.RMIMessages EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER
WARNING: Exception returned by remote server: {0}
java.lang.NoClassDefFoundError: javax/ejb/EJBHome
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at oracle.oc4j.rmi.ClientRmiTypeCache$InterfaceTypeCache.getNamedInterfaces(ClientRmiTypeCache.java:98)
at oracle.oc4j.rmi.ClientRmiTypeCache$InterfaceTypeCache.getInterfaceType(ClientRmiTypeCache.java:85)
at oracle.oc4j.rmi.ClientRmiTypeCache.getCachedType(ClientRmiTypeCache.java:33)
at com.evermind.server.rmi.RMIClientConnection.getBoundObject(RMIClientConnection.java:981)
at com.evermind.server.rmi.RMIClientInputStream.resolveObject(RMIClientInputStream.java:26)
at java.io.ObjectInputStream.checkResolve(ObjectInputStream.java:1346)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
at com.evermind.server.rmi.RMIClientConnection.handleLookupResponse(RMIClientConnection.java:825)
at com.evermind.server.rmi.RMIClientConnection.handleOrmiCommandResponse(RMIClientConnection.java:283)
at com.evermind.server.rmi.RMIClientConnection.dispatchResponse(RMIClientConnection.java:242)
at com.evermind.server.rmi.RMIClientConnection.processReceivedCommand(RMIClientConnection.java:224)
at com.evermind.server.rmi.RMIConnection.handleCommand(RMIConnection.java:152)
at com.evermind.server.rmi.RMIConnection.listenForOrmiCommands(RMIConnection.java:127)
at com.evermind.server.rmi.RMIConnection.run(RMIConnection.java:107)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:814)
at java.lang.Thread.run(Thread.java:595)
Exception in thread "main" java.lang.NoClassDefFoundError: javax/ejb/EJBException
at com.oracle.bpel.client.util.ExceptionUtils.handleServerException(ExceptionUtils.java:76)
at com.oracle.bpel.client.delivery.DeliveryService.getDeliveryBean(DeliveryService.java:254)
at com.oracle.bpel.client.delivery.DeliveryService.request(DeliveryService.java:83)
at com.oracle.bpel.client.delivery.DeliveryService.request(DeliveryService.java:53)
at view.Class1.main(Class1.java:40)
Process exited with exit code 1.
I have used checkpoints in between the code. It works fine till the third one. After that, it raises an exception.
Can anyone help me out with this?
Edited by: 846458 on Mar 22, 2011 11:04 AMHi
Can you try with below code
package com.otn.samples;
import java.util.Properties;
import java.util.Map;
import javax.naming.InitialContext;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import com.collaxa.xml.XMLHelper;
import com.oracle.bpel.client.ClientDefs;
import com.oracle.bpel.client.Locator;
import com.oracle.bpel.client.NormalizedMessage;
import com.oracle.bpel.client.delivery.IDeliveryService;
public class CallBPEL
public static void main(String[] args) throws Exception {
if (args.length != 1) {
System.out.println(
"I am here");
return;
try{
String ssn = args[0];
System.out.println("ssn is " + ssn);
// properties in the classpath
Properties props = new java.util.Properties();
java.net.URL url = ClassLoader.getSystemResource("context.properties");
props.load(url.openStream());
System.out.println(props);
String xml = "<ssn xmlns=\"http://services.otn.com\">" + ssn + "</ssn>";
Locator locator = new Locator("default","bpel",props);
IDeliveryService deliveryService = (IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME );
// construct the normalized message and send to collaxa server
NormalizedMessage nm = new NormalizedMessage( );
nm.addPart("payload", xml );
NormalizedMessage res = deliveryService.request("CreditRatingService", "process", nm);
Map payload = res.getPayload();
System.out.println( "BPELProcess CreditRatingService executed!" );
Element partEl = (Element) payload.get("payload");
System.out.println( "Credit Rating is " + XMLHelper.toXML(partEl) );
}catch(Exception e)
e.printStackTrace();
}Thanks
AJ -
Function and java class problem
Hi, i`m trying to develop a function that is using java class in body and return a table. I will show some code for better understanding.
I`m creating TYPE:
CREATE TYPE TYP1 AS OBJECT (
NUMER NUMBER,
NAZWA VARCHAR2(5),
KLOB CLOB,
RESULTS VARCHAR2(255));
CREATE TYPE TYP1_TAB IS TABLE OF TYP1;
Then im creating function
CREATE OR REPLACE FUNCTION GET_TAB(P_CURS SYS_REFCURSOR) RETURN TYP1_TAB PIPELINED IS
OUT_REC TYP1:=TYP1(NULL,NULL,NULL);
BEGIN
LOOP
FETCH P_CURS INTO OUT_REC.NUMER,OUT_REC.NAZWA,OUT_REC.KLOB;
//here i need to pass some parameters to java class stored in my database,
something like:
java_class(numer,nazwa,klob) return RESULTS and fetch them to out_rec.results;
EXIT WHEN P_CURS%NOTFOUND;
PIPE ROW(OUT_REC);
END LOOP;
RETURN;
END;
Please help me..
Best regards
RadekHi this is the Oracle Designer forum. You would be better off asking this question over at the SQL & PL/SQL place
PL/SQL -
Hello,
I have list of java classes. I have one java class which calls only the required functions from the list of java classes. When I try to create a VI on that java class I see all the functions needed but all of them are grayed.
Can anybody please help?
Best regards,
DharmiHas anyone else solved this problem? We too are experiencing the same problem.
We are trying to build a .JWS file from within an ANT build script. The build script compiles the site into a single EAR file that should contain a deployable and usable JWS component, however it obviously does not.
If anyone has a solution, please let us know. We're facing a code freeze on this project by this Friday and really need some help. -
Is there a tool that automatic create a java class related to a database? Similar dataset in .NET?
create a database? nyet.
There are relational databases written in Java and there are tools in java with which one can access a DBMS.
Either use a search engine, look at the java.sql and javax.sql packages, or post more information. -
Hi,
I am trying to call a java class using cfobject tag.
I placed my all classes under D:\cfm\ecpay\classes folder .
And add this path to jvm.config file.
I am getting class Not Found Exception while running my page.
Here is the code of cfobject
<cfobject
type = "java"
name = "myObj"
class = "ExcelToDb2"
action = "create">
<cfset ret = myObj.init()>
can some help me out on this.
ThanksIt is pretty straight forward and I think there would be a
problem for "Classpath". Please check it again in your CF admin.
There would be also syntax error.
Restarting the server is also required in case you compile a
new class etc.
Alternatively you can copy your classes into the directory
"cfroot\wwwroot\WEB-INF\classes" and restart the server before
testing them. -
I'm trying to pro-actively solve the timezone issue of
capturing and displaying data in local time for a global audience.
I found the timezone.cfc stuff (which looks like it should do a
great job), but can't seem to get it to initialize.
When it makes the call:
variables.timeZone=loader.loadClass("com.ibm.icu.impl.OlsonTimeZone").newInstance();
I get:
13:07:31.031 - java.lang.ClassNotFoundException - in
D:\Development\Serebra\TESTtimezone\REMOTEicu4jTZ.cfc : line 60
com.ibm.icu.impl.OlsonTimeZone
I'm initializing things with:
tz=createObject("component","REMOTEicu4jTZ").init("D:\path\to\jarfile\TESTTimezone\icu4j- 3_6");
I'm new to calling Java classes as objects, so it's entirely
possible I've screwed something up. Anyone have any pointers, or
even tips on how to ask the right question?1) get & install mark's javaLoader CFC from
http://javaloader.riaforge.org/
2) get the newest timezoneCFC from
http://www.sustainablegis.com/projects/tz/testTZCFC.cfm
3) read the readme file & make the modifications to the
init method to point to
where you put the javaLoader CFC & icu4j jar (it probably
won't be named icu4j.jar). -
Question on App Process and Java script performance
I have quick question regarding performance of Application process and Javascript.
I'm having OnDemand Application process, which fetches data from db and thru javascript
in page, i'm invoking the application process.
My question is :
If I did not render a page say for 10 mins, and i'm changing field values in my tab report.
Consider i'm having a huge record in my tab report and changing certain updatable column value for all records.
Once i finsished updating the field value (before hitting submit). The same field might have been updated by someother user.
If i render the page, Would it shows data as per current session value or data same as 10 mins before?
Bit confused on this.
Your views on this would be highly appreciated!!
Thanks!
Vijay... one more reason not to use Tabular Forms.
I'm not sure this is related to performance. I think this is more of a lost update question. If you're using a standard Tabular Form, APEX will check the value of that data in the database to see if it's changed since you opened it. If so, it means someone else edited the data then saved it since you opened the page. APEX will return an error. At that point, the user would have to reload the whole page. If you expect collisions and the fields are big enough that it will take a person a long time to edit, I would strongly suggest NOT using Tabular Forms. If you're only editing one row at a time, the chance of collision between you and another users is substantially less than if you were both editing 15 rows at a time. Also, if there is a collision, you only have to reload one record, not a whole set of them.
Tyler -
I tried importing the data from one schema to another but the Java classes that we use (via Java Stored Procedures) are showing up as invalid. Is there any reason why? We are using Oracle 10g R2. I tried resolving them by running the following sql, but that didn't work either:
ALTER JAVA CLASS "<java_clss>" RESOLVER (("*" <schema_name>)(* PUBLIC)) RESOLVE;
Any thoughts will be appreciated.There are two ways to instantiate a target's data. One is to use a native data loader or utility. In Oracle's case, Oracle Data Pump (not the "data pump" in GG) or SQL*Loader, as an example. The other way is to use GoldenGate's data pump.
You can configure DDL synchronization for Oracle, but you have to turn off the recycle bin. See Chapter 13 in the admin guide. -
GME PLLs, forms and java class files???
Hi,
if we generate forms of GME from adadmin PLLs will also get generated but how to compile java class files of a product GME ?
simply we need to create jar files?
RegardsHi,
if we generate forms of GME from adadmin PLLs will also get generated but how to compile java class files of a product GME ?No.
simply we need to create jar files?What do you mean by "create jar files"? Do you want to compile java classes? If yes, then the correct syntax is as follows:
SQL> ALTER JAVA CLASS "Object Name" RESOLVE;Regards,
Hussein -
How can i run a program outside of Forte? (Forte and java/class files)
im making a program with forte... and i have a bunch of class files, i form file and a java file... how can i put these in one file so poeple without forte can run it...
thanksjmburns wrote:
I am trying to do a silent install of a program I built using LabVIEW 8.5. I also need to call an exe after the installation, so I am using the "run executable after installation" option on the Advanced tab of the installer. I then pass the following command lines to the setup.exe:
/qb /acceptlicenses yes /r
This installs the LabVIEW program successfully, but does not then run the additional exe afterward. If I run the setup.exe normally (with no command line parameters), the additional exe gets run.
Thanks,
Jason
This problem is fixed in a future release of LabVIEW. Here's the CAR ID 67549 for tracking purposes.
Message Edited by Bob P on 07-10-2008 09:10 AM -
Question about main difference between Java bean and Java class in JSP
Hi All,
I am new to Java Bean and wonder what is the main difference to use a Bean or an Object in the jsp. I have search on the forum and find some post also asking the question but still answer my doubt. Indeed, what is the real advantage of using bean in jsp.
Let me give an example to illustrate my question:
<code>
<%@ page errorPage="errorpage.jsp" %>
<%@ page import="ShoppingCart" %>
<!-- Instantiate the Counter bean with an id of "counter" -->
<jsp:useBean id="cart" scope="session" class="ShoppingCart" />
<html>
<head><title>Shopping Cart</title></head>
<body bgcolor="#FFFFFF">
Your cart's ID is: <%=cart.getId()%>.
</body>
<html>
</code>
In the above code, I can also create a object of ShoppingCart by new operator then get the id at the following way.
<code>
<%
ShoppingCart cart = new ShoppingCart();
out.println(cart.getId());
%>
</code>
Now my question is what is the difference between the two method? As in my mind, a normal class can also have it setter and getter methods for its properties. But someone may say that, there is a scope="session", which can be declared in an normal object. It may be a point but it can be easily solved but putting the object in session by "session.setAttribute("cart", cart)".
I have been searching on this issue on the internet for a long time and most of them just say someting like "persistance of state", "bean follow some conventions of naming", "bean must implement ser" and so on. All of above can be solved by other means, for example, a normal class can also follow the convention. I am really get confused with it, and really want to know what is the main point(s) of using the java bean.
Any help will be highly apprecaited. Thanks!!!
Best Regards,
AlexHi All,
I am new to Java Bean and wonder what is the main
difference to use a Bean or an Object in the jsp. The first thing to realize is that JavaBeans are just Plain Old Java Objects (POJOs) that follow a specific set of semantics (get/set methods, etc...). So what is the difference between a Bean and an Object? Nothing.
<jsp:useBean id="cart" scope="session" class="ShoppingCart" />
In the above code, I can also create a object of
ShoppingCart by new operator then get the id at the
following way.
ShoppingCart cart = new ShoppingCart();
out.println(cart.getId());
...Sure you could. And if the Cart was in a package (it has to be) you also need to put an import statement in. Oh, and to make sure the object is accessable in the same scope, you have to put it into the PageContext scope. And to totally equal, you first check to see if that object already exists in scope. So to get the equivalant of this:
<jsp:useBean id="cart" class="my.pack.ShoppingCart"/>Then your scriptlet looks like this:
<%@ page import="my.pack.ShoppingCart %>
<%
ShoppingCart cart = pageContext.getAttribute("cart");
if (cart == null) {
cart = new ShoppingCart();
pageContext.setAttribute("cart", cart);
%>So it is a lot more work.
As in my mind, a normal class can also
have it setter and getter methods for its properties.True ... See below.
But someone may say that, there is a scope="session",
which can be declared in an normal object.As long as the object is serializeable, yes.
It may be
a point but it can be easily solved but putting the
object in session by "session.setAttribute("cart",
cart)".Possible, but if the object isn't serializable it can be unsafe. As the point I mentioned above, the useBean tag allows you to check if the bean exists already, and use that, or make a new one if it does not yet exist in one line. A lot easier than the code you need to use otherwise.
I have been searching on this issue on the internet
for a long time and most of them just say someting
like "persistance of state", "bean follow some
conventions of naming", "bean must implement ser" and
so on. Right, that would go along the lines of the definition of what a JavaBean is.
All of above can be solved by other means, for
example, a normal class can also follow the
convention. And if it does - then it is a JavaBean! A JavaBean is any Object whose class definition would include all of the following:
1) A public, no-argument constructor
2) Implements Serializeable
3) Properties are revealed through public mutator methods (void return type, start with 'set' have a single Object parameter list) and public accessor methods (Object return type, void parameter list, begin with 'get').
4) Contain any necessary event handling methods. Depending on the purpose of the bean, you may include event handlers for when the properties change.
I am really get confused with it, and
really want to know what is the main point(s) of
using the java bean.JavaBeans are normal objects that follow these conventions. Because they do, then you can access them through simplified means. For example, One way of having an object in session that contains data I want to print our might be:
<%@ page import="my.pack.ShoppingCart %>
<%
ShoppingCart cart = session.getAttribute("cart");
if (cart == null) {
cart = new ShoppingCart();
session.setAttribute("cart", cart);
%>Then later where I want to print a total:
<% out.print(cart.getTotal() %>Or, if the cart is a JavaBean I could do this:
<jsp:useBean id="cart" class="my.pack.ShoppingCart" scope="session"/>
Then later on:
<jsp:getProperty name="cart" property="total"/>
Or perhaps I want to set some properties on the object that I get off of the URL's parameter group. I could do this:
<%
ShoppingCart cart = session.getAttribute("cart");
if (cart == null) {
cart = new ShoppingCart();
cart.setCreditCard(request.getParameter("creditCard"));
cart.setFirstName(request.getParameter("firstName"));
cart.setLastName(request.getParameter("lastName"));
cart.setBillingAddress1(request.getParameter("billingAddress1"));
cart.setBillingAddress2(request.getParameter("billingAddress2"));
cart.setZipCode(request.getParameter("zipCode"));
cart.setRegion(request.getParameter("region"));
cart.setCountry(request.getParameter("country"));
pageContext.setAttribute("cart", cart);
session.setAttribute("cart", cart);
}Or you could use:
<jsp:useBean id="cart" class="my.pack.ShoppingCart" scope="session">
<jsp:setProperty name="cart" property="*"/>
</jsp:useBean>The second seems easier to me.
It also allows you to use your objects in more varied cases - for example, JSTL (the standard tag libraries) and EL (expression language) only work with JavaBeans (objects that follow the JavaBeans conventions) because they expect objects to have the no-arg constuctor, and properties accessed/changed via getXXX and setXXX methods.
>
Any help will be highly apprecaited. Thanks!!!
Best Regards,
Alex
Maybe you are looking for
-
17" flat panel Mac can no longer get on my Airport Extreme network
My 17" G4 flat panel iMac can't get on my Airport Extreme network. It has been on the network for years. All of a sudden I can't get on my own network. The Airport extreme uses a WAP2 Security password. Everything else in my home is on this network i
-
I have an iMac as my home computer, upgraded to this about a year ago from a windows pc and love it. However... I have a HP Compaq laptop that i am running with Windows Vista, which I use when travelling. A while ago, I believe on an update, to eithe
-
Relating outbound idoc to inbound idoc to create a document
We have a requirement to relate the outbound idoc to inbound idoc , transfer the data and create a document. Kindly let me know the tcode / configuration steps of how can we relate the idocs. Thanks, Nalini S.
-
Start sequence of components and process types
Hi all, I would like to know, is there any particular start sequence of the instance components and process-types while using opmnctl startall, or opmnctl startproc ias-component=..., or opmnctl startproc process-type=... ? Regards
-
Adding Display Only Assignment info on OTL timekeeper Entry form.
Hi My company is using OTL timekeeper Entry PUI form to record the attendance of employees. Our users want to have Employee's Organization from primary assignment to be automatically populated in a static field so that they can check if employee is i