This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Passing object from JSP tp Servlet" Watch "Passing object from JSP tp Servlet" New topic
Author

Passing object from JSP tp Servlet

vijay peyyala
Greenhorn

Joined: Sep 18, 2003
Posts: 7
How can I pass an object from a JSP to a Servlet or vice-versa ?
Thanks,
vijay
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.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
vijay peyyala
Greenhorn

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
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
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.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing object from JSP tp Servlet