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.
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 .
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