This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes JSP and the fly likes Call an EJB from JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Call an EJB from JSP" Watch "Call an EJB from JSP" New topic

Call an EJB from JSP

steve dowdall
Ranch Hand

Joined: May 23, 2001
Posts: 36
How do I call an EJB from a JSP? I have an ejb deployed on Weblogic and which runs fine from a stand alone java client. I would like to run it from the web using jsp. Not sure what the code needs to look like. I want it so that anyone with a browser can hit it.
sample code appreciated...
many thanks,
Tieyi Guo

Joined: Oct 29, 2001
Posts: 15
I do not have the sample code you asked for, however I think you should use some kind of JSP-Servlet-EJB model for your project. ie. using JSP for front end presentation, using servlet program as controller and using EJB as application logic, this fits the so called "MVC"-Model-View-Controller pattern.
The details as to how to invoke servlet from JSP and return back to JSP from servlet are quite simple and straightforward. You can find it in nay JSP book. You can invoke your EJB session bean from your servlet code and through the session facade to do all business logic stuff.
Hope this helps.
steve dowdall
Ranch Hand

Joined: May 23, 2001
Posts: 36
I'm using the MVC 5 layered architecture. I was just looking for some jsp code to call the ejb.
Liz Brown
Ranch Hand

Joined: Oct 22, 2002
Posts: 112
I heard about MVC2 . what's MVC5 here? can you please explain.
Ronak Patel
Ranch Hand

Joined: Aug 14, 2002
Posts: 31
Hi ,as per my knowlege there are just 2 model of MVC(1 and 2).
Whats MVC 5 man?
I agree. Here's the link:
subject: Call an EJB from JSP
It's not a secret anymore!