File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes how to  create always new session 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 » Servlets
Bookmark "how to  create always new session" Watch "how to  create always new session" New topic
Author

how to create always new session

prasad kakani
Ranch Hand

Joined: Jul 15, 2008
Posts: 59
Can you please help me how to create always new session.
kranthi
Greenhorn

Joined: Dec 17, 2008
Posts: 10
Hi prasanth,

try like this to create a new session


HttpSession hs=request.getSession(true);
Integer i=(Integer)hs.getAttribute("ctrl");


Regards<br />kranthi
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

"SriLatha" please check your private messages for an important administrative matter. You can see them by clicking the My Private Messages link above.


SCJP, SCWCD.
|Asking Good Questions|
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4167
    
  21

Originally posted by SriLatha:
Hi prasanth,
try like this to create a new session
HttpSession hs=request.getSession(true);
Integer i=(Integer)hs.getAttribute("ctrl");


Note that request.getSession(true) doesn't always create a new session. It will only create a new session if one doesn't already exist. If one already exists then the old one will be used.

Question for Prasad: Why do you want to always make a new session? If you don't want the data to be shared between requests by the same user you should store the data in the Request scope rather than the Session scope.


Steve
 
wood burning stoves
 
subject: how to create always new session
 
Similar Threads
getsession(false)
Actually wht is a session????
transaction rollback during multiple session
Can we create more than one session in a Client ?
create a new session when valid session is already existing?