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

Regarding sessions and cookies

Santhana Lakshmi.S
Ranch Hand

Joined: Aug 16, 2005
Posts: 82
Hi,
I created one web page in jsp.
In that i want to keep track of the username entered in the login page.

i tried with the following code but it's not working after 3 r more pages
i want to keep track till the user logout.
the code is used is
String name=request.getParameter("username");
session.setAttribute("usernamesession",name);



and in the next page i retrieved
lik this
out.println(session.getAttribute("usernamesession"));
Its working fine in for 3 pages after that it s displaying null value.
can anyone tell me how to keeptrack of the username until the user logout
thanx a lot
Heonkoo Lee
Ranch Hand

Joined: Feb 10, 2005
Posts: 85
Originally posted by Santhana Lakshmi.S:
Its working fine in for 3 pages after that it s displaying null value.


It could be because of session timed out. Did you check the session-timeout value in web.xml?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61222
    
  66

A session timeout is an unlikely culprit as the act of navigating between the pages will reset the session timer. A session timeout will only occur if there a prolonged period of inactivity between actions that exceeds the length of the session timeout value.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Heonkoo Lee
Ranch Hand

Joined: Feb 10, 2005
Posts: 85
Yeah, it is unlikely unless the inactivitity time between navigation is more than time out value.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Regarding sessions and cookies