• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session Creation

 
Dave Wingate
Ranch Hand
Posts: 262
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've got a test web app going in which I do not call request.getSession() in any servlets, jsps, tags, etc.. However, I do call request.getSession(false). To my surprise, the latter call returned a Session object; I had expected null.

Can anyone pls explain why a session was created for me w/o my ever having explicitly requested that one be created?
 
Hongli Li
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do you use Struts in your application, if so, struts automatically creat a locale attritue and store it into a session. why do not you try to print out all the session variables, and see what's inside that session?
[ January 07, 2007: Message edited by: Hongli Li ]
 
Scott Johnson
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Create an HttpSessionListener with a sessionCreated() method that dumps the stacktrace and whatever is in the Session.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSPs, unless you specifically disable them with session="false" in the page directive will create a session for you automatically.
 
Dave Wingate
Ranch Hand
Posts: 262
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, thanks. I forgot that if JSPs have an implicit reference to a session object, then a session object must have been created.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic