How to retain session variable
I am trying to retain the Session variable which is getting removed(deleted) in one of the Actions.
I tried passing the Session variable to another session variable and at the end, reassigned the changed variable to the original variable.
Even this does not work. After deleting the original variable, the contents of the new session variable are also getting deleted.
Can any body help me to resolve this.
How to retain the session value
Try to save the value of the session in a String variable and pass it using URL rewriting. and then retrive the value using getParameter();
first pass the Session value in the servlet context.
HttpSession sess = req.getSession(true);
ServletContext context = getServletContext();
Now in another servlet...
Object sessionIdObj = context.getAttribute("sessionId");
String sessionIdValue = sessionIdObj.toString();
Now simply use the value stored in sessionIdValue, to retain the session.
Last Post: 08-27-2002, 01:21 PM
Last Post: 07-06-2001, 02:10 AM
By Sachin in forum ASP.NET
Last Post: 11-11-2000, 03:18 AM
By Nate in forum Enterprise
Last Post: 10-13-2000, 01:38 PM
Last Post: 09-01-2000, 04:41 PM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL