dcsimg
Keeping Session Alive in JSP of single user
4 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Kunjan_Vaishnav
Posted On:   Tuesday, July 8, 2003 06:54 AM


Hi
I want keep the particular session of a client alive until he logs out. As I am using JSP and Beans even using setAttribute() and getAttribute() I am facing problems. The session is closing after 4-5 page visits to so can someone give me some model code for making the stateful Session Bean which remains alive until my user logs out. Thanks in Advance.

Re: Keeping Session Alive in JSP of single user

Posted By:   Anonymous  
Posted On:   Tuesday, July 15, 2003 04:28 AM

Hi Kunjan,
another alternative for this is to increase the timeout parameter (connectionTimeout=60000 (MilliSeconds) in server.xml in tomcat). If the timeout is 60 secs, if the user remains idle for more than 60 secs, the session object would be destroyed. By increasing the timeout value, session will not be destroyed even if the user remains idle for sometime.

Re: Keeping Session Alive in JSP of single user

Posted By:   mureed_Al_Alem  
Posted On:   Tuesday, July 15, 2003 03:51 AM

put this tag in the header of your pages
<@ page isThreadSafe="false" >
this will prevent which we called concurancy

Re: Keeping Session Alive in JSP of single user

Posted By:   Stephen_McConnell  
Posted On:   Wednesday, July 9, 2003 05:21 AM

The only way your "session" is closing after 4-5 page visits is that the user sits on one page till the session times out. If the user visits another page before the "session" times out, then the session will not be lost.


One way of preventing this, although it is not very secure, is to create a "hidden" input HTML tag that holds a value unique to the user/session. Or append such a value to every link url on every page.


When the user goes to another JSP/Servlet, the name/value pair is a request parameter and can be extracted from the request object, then placed in the next page that is referenced.


The user receives this value upon log-in and it is stored in a database associated with the user's login. You create a bean that gets this "session" value, determines if the session value is already associated with a user and validates it.


If it is valid, it allows the user to view the next page, if not, the JSP redirects the user to a log-in page.


This is not a Statefull Session Bean but it is one way to persist the session's state.


Some Web servers will persist the entire request and session object in a common database associated with a user (IBM Websphere is one) to be used for load balancing, and persisting the session state....


You can be as creative as you want to be with this.


Stephen McConnell

Re: Keeping Session Alive in JSP of single user

Posted By:   Christopher_Koenigsberg  
Posted On:   Tuesday, July 8, 2003 07:12 AM

someone give me some model code for making the stateful Session Bean


Warning: the "session" in "SessionBean" (EJB) is different than the "session" in "HttpSession" (servlet)....

About | Sitemap | Contact