• Post Reply Bookmark Topic Watch Topic
  • New Topic

Passing the session variable from one HTML to JSP through Servlets?  RSS feed

 
Priya dharshini
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to post the session variable from one HTML to JSP through Servlets?



-----------------------------------------------
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Session is already available in jsp via the implicit object "session".
Why would you want to pass it from a servlet ?
 
Priya dharshini
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In servlets, we are creating different sessions by giving the different session variable name. In JSP how can create different session variables?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you do that ?
Sorry, I can't clearly understand what you are trying to do
 
Priya dharshini
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you create more than one session in servlets?
 
Liyaquat Ali
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

U can definitely create more then one Session variables but they will just be reference variables pointing to the same Session object.

for example:-

HttpSession objSess1 = request.getSession();
HttpSession objSess2 = request.getSession();

but both objSess1 and objSess2 point to the same session object, the actual session object which stores the session info and the session attributes.

U would never need to pass the Session object to the JSP using code as it is automatically done by the container and can be accessed in the JSP by using the 'session' implicit object.

Do clarify what exactly U wish to do so that we can explain better.
 
Priya dharshini
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi..In JSP its possible to create more than one session?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!