aspose file tools*
The moose likes JSP and the fly likes Session Variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Session Variables" Watch "Session Variables" New topic
Author

Session Variables

Mathews P Srampikal
Ranch Hand

Joined: Nov 26, 2002
Posts: 211
how the server will know whether this session is belongs to usr1 or usr2 in the request......How the URL rewriting works with a session.
Thanks


Thanks,
Mathews
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Mathews
Every time a session is created there is a unique session id created by the container and sent to the browser that originated the request that created the session. So if you have two users they would each get their own session id and then every time they request a resource from that application the container gets the session id from the cookie that is stored on the users computer.
URL rewriting is used for when cookies are disabled, it works by taking any URLs sent back to the client and appending the session id to it, that way the session id is part of any request sent by the browser to the container.
Does that help, if you need a more detailed explaination let me know.


Dave
Mathews P Srampikal
Ranch Hand

Joined: Nov 26, 2002
Posts: 211
Thanks Dave
varun bihani
Ranch Hand

Joined: Aug 11, 2003
Posts: 96
The more simple method I guess would be assign a unique ID for each user to the particular name and setting its session attribute like this..
session.setAttribute("userid",userid);
and then getAttribute like..
String userid=(String)session.getAttribute("userid");


<a href="http://www.galaxyweblinks.com" target="_blank" rel="nofollow">www.galaxyweblinks.com</a><br /><a href="http://www.freechatcode.com" target="_blank" rel="nofollow">www.freechatcode.com</a><br /><a href="http://www.onlinefamilytreemaker.com" target="_blank" rel="nofollow">www.onlinefamilytreemaker.com</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session Variables
 
Similar Threads
Session Tracking
limit the no of sessions with struts.
How to invalidate session on the basis of session ID in servlet
How to know size of a session
Session