aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes jsp and ejb Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "jsp and ejb" Watch "jsp and ejb" New topic
Author

jsp and ejb

jonny jinny
Greenhorn

Joined: Oct 29, 2002
Posts: 11
I am trying to access container managed bean from jsp using a java bean.
It gives me following err arsing of JSP File '/TestJSP.jsp' failed:
--------------------------------------------------------------------------------
/TestJSP.jsp(7): class 'examples.ejb20.basic.containerManaged.AccountJB' could not be loaded
probably occurred due to an error in /TestJSP.jsp line 7:
<jsp:useBean id="account" scope="request" class="examples.ejb20.basic.containerManaged.AccountJB" />
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
could it be that your missing the E out of EJB
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Originally posted by jonny jinny:
I am trying to access container managed bean from jsp using a java bean.
It gives me following error parsing of JSP File '/TestJSP.jsp' failed:
--------------------------------------------------------------------------------
/TestJSP.jsp(7): class 'examples.ejb20.basic.containerManaged.AccountJB' could not be loaded
probably occurred due to an error in /TestJSP.jsp line 7:
<jsp:useBean id="account" scope="request" class="examples.ejb20.basic.containerManaged.AccountJB" />

There is a big difference between JavaBeans and Enterprise JavaBeans(EJBs).
The useBean tag is meant to be used with JavaBeans, not EJBs. There is a alot more that goes into using an EJB... acquiring an initial context, looking up the home interface, getting an EJBObject, invoking the business method, etc.
If you really want to use the useBean tag to access your EJB, then you will need to wrap it with a standard JavaBean. Some tools, such as WSAD, provide this functionality for you. Overall, abstracting the details of EJB access from the client is a good thing.
Take a look at the Business Delegate Pattern.
Since we are on the subject, it is also not advisable to directly access Entity Beans from the client.
Take a look at the Session Facade Pattern.
[ March 27, 2003: Message edited by: Chris Mathews ]
jonny jinny
Greenhorn

Joined: Oct 29, 2002
Posts: 11
Hi!!
I am doing the same.
accessing AccountJB which is a java bean who in turn accesses EJB.
jonny jinny
Greenhorn

Joined: Oct 29, 2002
Posts: 11
Hi,
Here is the code written in AccountJB.
Its giving the following err to me:
C:\bea\wlserver6.1\config\examples\clientclasses>java examples.ejb20.basic.conta
inerManaged.AccountJB
Unable to lookUp1
Prob in lookup
---------
CODE;

---------
(edited by Cindy to format code using [ code] and [ /code] tags without the spaces)
wht could be the prob, please help.
[ March 28, 2003: Message edited by: Cindy Glass ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jsp and ejb