This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Servlets and the fly likes Return object from servlet to jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Return object from servlet to jsp" Watch "Return object from servlet to jsp" New topic
Author

Return object from servlet to jsp

Tim Berett
Ranch Hand

Joined: Jun 14, 2002
Posts: 35
Can someone tell me how to return a object from the servlet to the jsp page? Any sample codes for servlet and jsp portions?

Newbie here.
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
Welcome to the JavaRanch! Please adjust your displayed name to meet
the <BR>JavaRanch
Naming Policy
. <BR>You can change it here.<BR><BR>Thanks!
and welcome to the JavaRanch!
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12268
    
    1
The usual way of allowing servlets and JSP to share objects is by attaching the object to either a HttpSession or the ServletContext. It depends on whether the object contains data specific to a particular user or if it is more general.
NOTE: you can only share objects this way between servlets and JSP in the same "web application."
The methods are all in the servlet API - you should have a copy if you are going to be serious about servlets.
Bill


Java Resources at www.wbrogden.com
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Return object from servlet to jsp
 
Similar Threads
JSP/Servlet combination
Action Forms and Beans
Alternate Method to post request from Servlet to Jsp
Can a Servlet return an object
How to return an object instance by JSP