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 session tracking in jsps using cookies Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "session tracking in jsps using cookies " Watch "session tracking in jsps using cookies " New topic
Author

session tracking in jsps using cookies

raj lakshmi
Greenhorn

Joined: Sep 03, 2003
Posts: 7
Hi all,
I am buddy programmer in using servlets and jsps.
Here I need to maintain session tracking of the user logged in to my web site and this session need to be tracked in different jsp pages and servlets.
Try to give me a proper method and code snippets if any.
Thanks a lot in advance,
cheers,
Rajalakshmi.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
via cookies or urlwriting it is done automatically. You just get a HttpSession in the servlet/jsp code, it is handled by the servlet container/ appln server further.
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Raj
The container will automatically track session information for you, all you need to do is tell it to create the session and what data to track. If you are are using cookies (if cookies are enabled on the client) the there is nothing eles you need to do except manipulate the data. If cookies are disabled then you'll need to use url rewriting to add the session id to any urls you are going to pass to the browser. Here are a few of the methods you'll need to look at:
HttpServletRequest.getSession(boolean create)
HttpSession.setAttribute(String name, Object value)
HttpSession.getAttribute(String name)
HttpServletResponse.encodeURL(String url)
Hope that all helps, if you are looking for more concrete examples, post a more specific question and we'll help you out.
Dave


Dave
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: session tracking in jsps using cookies
 
Similar Threads
JSP/WML and session tracking
Session Tracking in Wap
HFSJ Doubt, Mock exam on page 265 (Session management), 5 question.
Session in an application having html,servlets,Jsp
JSESSIONID