This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JSP and the fly likes session out problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "session out problem" Watch "session out problem" New topic
Author

session out problem

Rubel Ahammad
Greenhorn

Joined: Feb 05, 2005
Posts: 19
dear friends,
i'm new to jsp. i'm facing a strange problem. i have an index page where i wrote the code for user authentication. after i login to the application if i dont work with that application for a certain amount of time say 10 min ( the time that has been set in the web.xml file under session-timeout tag), i'm redirected to the index page if i send any request for a new page. then i need to relogin. but i want the session to be backed up before it expires and wish to retrieve some information from that session object. so that i can reuse that information in index.jsp page and based on that information i wish to redirect the user to some other page.

can anybody help me out to save session object in a SQL server db. and retrieve that .


thanks in advance.


rubel ahammad<br /> <br />SCJP 1.4 (91%)<br />SCWCD 1.4 (Preparing)
Rubel Ahammad
Greenhorn

Joined: Feb 05, 2005
Posts: 19
i'm using tomcat 4.1.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12809
    
    5
Your best bet is NOT to try to save the session object - there is no user interface for restoring a session from outside the servlet container.

Instead, incorporate the information in a Plain Old Java Object (POJO) that is Serializable and store the reference to the POJO in the session. Also save the serialized object to a database or file system whenever the data changes. With a POJO you can test your save/restore code outside the JSP environment and if you use JavaBeans conventions you can use the various JSP shortcuts for beans.
Bill
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: session out problem