Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sessions

 
Tom Joiner
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to use sessions to keep track of when a user is logged in to the website. It is only working on pages which are redirected from the one where the session is set- it does not work if the user links to a new page.

So my first page has the following code (which has been gotten from the database successfully). It redirects to another page




This new page works, in that it can extract the friendlyName and accountID, like this



However, this same code on any other page, does not work. If you press a link to go to another page, it does not see the friendlyname.

Any ideas?
[ March 05, 2007: Message edited by: Tom Joiner ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Before anything else, why are't you just using the session builtin variable?
 
Bosun Bello
Ranch Hand
Posts: 1510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are sending a redirect which asks the client(browser), to make initiate a new request to the associated URL.

As Bear suggested, you do should just be using the session built in variable. No need for a redirect. As long as they are bot part of the same session it should see the attributes set by the first servlet.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic