wood burning stoves*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes container creating session automatically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "container creating session automatically" Watch "container creating session automatically" New topic
Author

container creating session automatically

Sigrid Kajdan
Ranch Hand

Joined: Jan 14, 2007
Posts: 72
Hello,

my web app does not use sessions (there's no request.getSession()) anywhere).
But I find that the jsessionid cookie is set anyway!
Can anybody tell me why that's the case? Does Tomcat send the jsessionid cookie automatically?
Thanks a lot,
Sigrid
Stary Kapec
Ranch Hand

Joined: Dec 04, 2005
Posts: 81
Does your application contain jsp pages? If so that is the case. Jsp page implicitly creates new session if none exists. You can turn it off by using page directive with session attribute.

<% page session="false" %>

If you checked the generated java file for the jsp page there you would see HttpSession session = request.getSession(). This is how the implicit jsp session object is initialized. If you turn session off the session object will not be created, check it!
Sigrid Kajdan
Ranch Hand

Joined: Jan 14, 2007
Posts: 72
Yes, it works! Thank you!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: container creating session automatically
 
Similar Threads
reading SESSIONID header.
Problem with session
How to set JSESSIONID's maxAge?
JSESSIONID
JSESSIONID over SSL only... HELP!!