Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Life cycle fo session attributes

 
sruthi reddy
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am using session atttibutes to know whether a user is loged in or not.Basically what i am doing is i am authenticating user with database and if user's username and password are correct, then in the sevlet i am setting a string to yes value and checking that condition where ever required in the application.But in some pages of application, i have a link which will call my main page.If user is loged in then, my main page should have user details but its not happening. my session attributes are not available in main page. Can anyone suggest me what to do.
Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is happening?
[ August 08, 2008: Message edited by: Bear Bibeault ]
 
sruthi reddy
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am setting session attributes like this

request.getSession().setAttribute("usName", usrName);
request.getSession().setAttribute("isLoggedIn", testLogin);
response.sendRedirect("Online/CalenderDisplay.jsp");

and i am able to get back those values in CalenderDisplay.jsp (my main page) but when i am trying to get attributes from other pages, i am getting null value.
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps you are attempting to retrieve it with the wrong keys ? Why dont you try printing all the keys and values in the session attribute scope ? You can also register some listeners in case you want to be notified when a session object is added or removed or replaced. This way any change in these values will be visible to you via debug statements.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to get attributes from other pages, i am getting null value.


Are all of these pages in the same web application? Show us the URLs by which these pages are reached.

Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic