Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
2.60/5 (2 votes)
See more:
How to put sessions in other pages? (jsp,servlet,java using DAO).In jsp pages i used combo boxes to go to other pages. is it possible to put sessions in that pages or are there any ideas for this?

Thank you in advanced!
Posted
Comments
Shubhashish_Mandal 7-Jul-13 5:17am    
I think you have to read about what is session and how it works.Once you read it you can understand that you don't need to pass the session. Once you set anything in session , you will access it form any pages within the app for the current user

1 solution

Session are not belong to pages, it seems you have set your scoop as request (request scoop is for a page invocation)

simply track your session with request.getSession() for example
in page 1:
Java
<![CDATA[<%
  request.getSession().setAttribute("name","value");
%>]]>


and then get the session values in page 2
Java
<![CDATA[<%
 String name=(String) request.getSession().getAttribute("name");
%>]]>


the default session timeout is 30 min while you can extend it, but for having long time data, use cookies instead
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900