Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session usage in JSP

 
saurav sarkar
Ranch Hand
Posts: 180
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,


Just a general question in JSP.If my app is used by loads of users
concurrently.Does using the session for retrieving the objects causes any problem?.

Most of objects are in request scope but in some cases i have to use session scope.So in those cases in my java classes i am using in the session.But while retrieving in the JSP i am using the request scope by putting the object in the request before forwarding it to the JSP.

Please help
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64685
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Session scope should only be used for user-specific data that needs to stick around for more than one request. For simply passing data from a controller servlet to a JSP for display, the request is the correct scope to use.

When creating session data, especially in an environment where there are many users, it's important to be sure to release any data that is no longer being used to avoid unnecessary memory overhead. This leads some misinformed shops to disallow use of the session completely -- which is pretty silly. Just be sure to do a bit of housekeeping to make sure that session data doesn't hang around for longer than it needs to.
[ February 12, 2008: Message edited by: Bear Bibeault ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic