Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing object from JSP tp Servlet

 
vijay peyyala
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I pass an object from a JSP to a Servlet or vice-versa ?
Thanks,
vijay
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
vijay peyyala
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for not being clear, I dont want to make the session overloaded
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic