It's not a secret anymore!
The moose likes Servlets and the fly likes JSP & EJB compatibility Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "JSP & EJB compatibility" Watch "JSP & EJB compatibility" New topic

JSP & EJB compatibility

r venkat

Joined: Jan 09, 2001
Posts: 8
hello friends,
i would like to know how i can connect my ejbean in my JSP?
can any one help.
Dustin Marx
Ranch Hand

Joined: Mar 06, 2001
Posts: 40
I am not sure if this will answer what you are asking, but I'll give it a try.
The application server normally provides an EJB container and a JSP container and allows for you to change appropriate settings to let EJBs and JSPs communicate with one another. At that point, you can have Java directly in the JSP (or in a JavaBean used by the JSP) access EJBs as normal Java code does (getting the home interface, etc.).
r venkat

Joined: Jan 09, 2001
Posts: 8
i'll give it a try thanks
post your result too
Desai Sandeep
Ranch Hand

Joined: Apr 02, 2001
Posts: 1157
Dustin, is absolutely correct
Venkat, you would need to remember that JavaBean is acting as a client to your EJB, for your JSP.You will have to get the instance of the HomeObject to create an instance of EJBObject in your JavaBean later in your code, to access the EJB.
The following sample code might be helpful to you.

Sandeep Desai

  1. Sun Certified Java Programmer Scored 93 per cent
  2. Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
  3. IBM Enterprise Connectivity with J2EE Scored 72 per cent
  4. Enterprise Development on the Oracle Internet Platform Scored 44 out of 56

  5. [This message has been edited by Desai Sandeep (edited April 27, 2001).]
I agree. Here's the link:
subject: JSP & EJB compatibility
It's not a secret anymore!