• Post Reply Bookmark Topic Watch Topic
  • New Topic

simple sessions help  RSS feed

 
john latham
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

Im just trying to use sessions to store a username in one page, and read it in another, as follows.

But it keeps telling me that username is null (ie. it thinks the session attribute username doesnt exist).

I think i identified the problem. Each time i go to a new page and check for the username attribute in the session - a new session is created instead of looking in the existing one.

Do i need to set, import or initlalise something before i can use sessions.

Note im using Tomcat 5.5.9 bundled in Netbeans 5.0.

Please help, thanks




[ May 28, 2006: Message edited by: john latham ]
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see anything wrong with the code you have provided. You have left out how you are grabbing the session from the request each time, which might pose a clue. I did basically the same thing you did and all was fine.

login.jsp


index.jsp
 
john latham
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My firewall was somehow blocking my sessions so i closed it and my session code started working.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!