• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

request.getSession(false)

 
Sharmila Punde
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,
I started tomcat and accessed TestJsp.jsp which has following jsp code-

Was expecting NullPointerException. But output was as -
Session id:A29B24857E8ADD8F208968704343E5A9

Why it printed session id? Was it because session was stored in tomcat. If it is true then,
where can i find stored sessions in tomcat 5.5.28 so that i can delete it.

Thanks




 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2532
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sharmila,

In a JSP is the session object by default available unless you put the following page directive in you JSP:


Regards,
Frits
 
Ankit Garg
Sheriff
Posts: 9577
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to "delete" the session, then the session class has an invalidate method which will terminate that session.

Frits you forgot to put false in double quotes :-)
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2532
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frits you forgot to put false in double quotes :-)


Oops, you are right, I should try the code before I put it ;(
 
Rohan kanade
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or you can delete the cookies set by your browser under the domain localhost. The name of the cookie is JSESSIONID.
 
Ankit Garg
Sheriff
Posts: 9577
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rohan kanade wrote:Or you can delete the cookies set by your browser under the domain localhost. The name of the cookie is JSESSIONID.

That won't help much as when you refresh the JSP page, a new session will again be created. Setting session to false in page directive is needed to stop the container from making a new session automatically...
 
Sharmila Punde
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Frits, Ankit, Rohan. Very helpful information!
Thanks again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic