my dog learned polymorphism*
The moose likes JSP and the fly likes Session usage in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Session usage in JSP" Watch "Session usage in JSP" New topic
Author

Session usage in JSP

saurav sarkar
Ranch Hand

Joined: Jan 07, 2007
Posts: 180

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


Be Objectively Oriented.Explore the power of OOPs.
My Blog, Eclipse EMF Query committer.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

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 ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
 
subject: Session usage in JSP
 
Similar Threads
Need to understand the Request Scope
Session Issue
lifecycle of session and request
jsp scope problem
problem while keeping scope as session