Two Laptop Bag*
The moose likes JSP and the fly likes Passing object from JSP tp Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Passing object from JSP tp Servlet" Watch "Passing object from JSP tp Servlet" New topic

Passing object from JSP tp Servlet

vijay peyyala

Joined: Sep 18, 2003
Posts: 7
How can I pass an object from a JSP to a Servlet or vice-versa ?
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
You can pass/exchangeobjects between them by either setting it on the request, session, or even the application. It depends on what you are trying to achieve. You may want to read up or search for session management in this forum.

So much trouble in the world -- Bob Marley
vijay peyyala

Joined: Sep 18, 2003
Posts: 7
Sorry for not being clear, I dont want to make the session overloaded
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12756
The whole idea of sessions is to provide an efficient method for keeping objects between requests and passing them between servlets. Any other solution you come up with would probably be less efficient.
If you are worried about the memory consumed, remember that you can force the session to drop any object reference with removeAttribute(), you don't have to depend on the session timeout mechanism, but it will be there as a final cleanup mechanism.
I agree. Here's the link:
subject: Passing object from JSP tp Servlet
Similar Threads
Static/Dynamic resources
Return object from servlet to jsp
How do i forward db resultset from servlet to jsp
Alternate Method to post request from Servlet to Jsp
servlet to jsp