This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JSP and the fly likes Managing Session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Managing Session" Watch "Managing Session" New topic
Author

Managing Session

AshishcKumar singh
Greenhorn

Joined: Dec 16, 2008
Posts: 9
Hi all!

I am making a discussion forums site. I want to track user's using session object.
I am creating session as follows:-

String Username=request.getParameter("textuname");
session.setAttribute("userid",Username);

i am retrieving the value when required.

Doubt m having is that if on 'logout' by any user if i invalidate the session using session.invalidate(); wont it destroy sessions of all other users online???

What i need is tat only session of that particular user is destroyed and all others who are online can keep continuing with their tasks.

Thanks..
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

No, each user has their own session.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
AshishcKumar singh
Greenhorn

Joined: Dec 16, 2008
Posts: 9
Hi thanks for replying..

You mean there'll be automatic handling of each user's session??

Please explain me this:--

i am giving the session's name as "userid". On each user's pc..there'l a temporary cookie created by this session object named "userid" or what??..

How is it going to work?can you please explain me all this?..

thanks.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18152
    
    8

I don't understand that. You said
i am giving the session's name as "userid"

But in your original post you showed an example of putting an attribute named "userid" into a session.

Here's what you need to know: the container will maintain a session for each user. You don't really need to know how it does that. Whether it uses cookies or URL-rewriting or ventricles, you don't care. You can have a session for each user.
AshishcKumar singh
Greenhorn

Joined: Dec 16, 2008
Posts: 9
Alright!..
Thanks man..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Managing Session
 
Similar Threads
How to Ensure Session Created with Login Name
Regarding cookies disabled and session info lost
getUserpricipal()
[Spring] Obtain a session or request object
Query regarding Session Tracking