File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Sessions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Sessions" Watch "Sessions" New topic
Author

Sessions

Tom Joiner
Ranch Hand

Joined: Sep 19, 2006
Posts: 47
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 ]

SCJP
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

Before anything else, why are't you just using the session builtin variable?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
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.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sessions
 
Similar Threads
why Internet Explorer is different than other browsers in jsp?
multithreaded web application session issue
IllegalStateException in servlet
WAS4.0 Session Persistence
Session is not invalidated