Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "session out problem" Watch "session out problem" New topic

session out problem

Rubel Ahammad

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

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

Joined: Mar 22, 2000
Posts: 12761
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.
It is sorta covered in the JavaRanch Style Guide.
subject: session out problem
Similar Threads
error when I try to retrieve data stored in session variable
how do i differentiate two instance or client
JSF to Struts conversion
Session tracking (via session object) Problem
Retrieving information from previous page's form