Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to get a session only if one exists already?  RSS feed

 
manohar reddy
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If we want to get the session in a servlet, only if a valid session is pre-existing, how should we get the session.

[ UD: added meaningful subject line ]
[ November 23, 2007: Message edited by: Ulf Dittmer ]
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16006
87
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you post a question, please use a meaningful subject line. Instead of "Please help me", use something like "How do I get the session in a servlet?". Imagine what the forum would look like if everybody would write "Help!", "Please...", "Problem!", etc...
 
Hanuma Deepak Muvvala
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use getSession(false) method of HttpServletRequest interface which will return session if already exists else returns null.

Deepak...........
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!