This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Storing variables in the session 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 » Servlets
Bookmark "Storing variables in the session" Watch "Storing variables in the session" New topic
Author

Storing variables in the session

rastas biggs
Ranch Hand

Joined: Sep 24, 2004
Posts: 41
Hi there,

Rather than appeanding variables to a url is it better on my controller servlet to store the variables in the session?

Can some one give me an idea of the advantage/disadvantages to this approach?

RAS
Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624

Storing items in Session Variables provides many advantages. There's a free online version of the first edition of Core Servlets & JavaServer Pages avaialbe at the website www.coreservlets.com (the link to the pdf is down towards the bottom of the home page). There is a chapter on Session Management which disusses the advantages of session variables over parameters. Keep in mind that that edition of the book is based on the older Servlet & JSP specs (specifically the Servlet v2.1 & 2.2 and JSP 1.1 specs). A lot was added in both the 2.3/1.2 and 2.4/2.0 versions of the specifications. Nonetheless, the basic concepts of session management remain the same, but the tools (i.e. the available classes and methods) have changed.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Here is one more read chapter 9 of this book.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Storing variables in the session
 
Similar Threads
How to share variables in Struts tiles?
passing beans between jsps
Getting JSP bean from Servlet
in struts2 how can I use session variables
Limit to number & size of variables in "session"