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, 12:21 PM
Last Post: 07-06-2001, 01:10 AM
By Sachin in forum ASP.NET
Last Post: 11-11-2000, 02:18 AM
By Nate in forum Enterprise
Last Post: 10-13-2000, 12:38 PM
Last Post: 09-01-2000, 03:41 PM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center