wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android 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: 12761
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.
Consider Paul's rocket mass heater.
subject: Passing object from JSP tp Servlet
Similar Threads
servlet to jsp
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