Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can we maintain more than one session?

 
Gaurav Chikara
Ranch Hand
Posts: 412
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
Can we create more than one session in a servlet
as My application requires that based on the field i select i shud put some value in session object
if we can have more than one session object then i can
put value for each condition in seperate session
so that retrieving is easier later on
any suggestions pls
 
Randall Twede
Ranch Hand
Posts: 4467
3
Java Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im not certain, but I think there can be only one session. The session is usually created by calling getSession() method of HttpServletRequest class. There is an API for servlets somewhere at the sun site but im not sure of the exact url. http://java.sun.com/
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just use the one session but apply some imagination to the way you manipulate the objects stored in the session. A session is basically a Hashtable after all - you can create the name of the attribute to reflect the circumstances under which you want to retrieve it.
Everybody working with servlets or JSP should have a copy of the API documents, you can download them from java.sun.com.
Bill

------------------
author of:
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's under the heading Java 2 SDK, Enterprise Edition in http://javasoft.com/j2ee/docs.html as "API Documentation".
[This message has been edited by Tony Alicea (edited February 15, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic