Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Storing variables in the session

 
rastas biggs
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 624
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is one more read chapter 9 of this book.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic