Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

request.getSession(false)

 
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




 
Creator of Enthuware JWS+ V6
Posts: 3341
303
Android Eclipse IDE Chrome
  • 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
 
Sheriff
Posts: 9671
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • 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
Posts: 3341
303
Android Eclipse IDE Chrome
  • 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 ;(
 
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: 9671
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • 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.
 
Seriously Rick? Seriously? You might as well just read this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic