I have absolutely nothing wrong with my code and I checked a 100 times but I am still loosing sessions from one page to other...
I am getting the session okay on one jsp page which has a html form. Once that form is submitted ... I am not changing anything in the session and I just cant get the session in the next Servlet which is called when the form is submitted?
There is no particular place...Its happening on everyother page... I set it and the next page it works but it doesnt work in the next to next page when I do getAttribute even though I dont change it or set it to null...
Like in the servlet I say session.setAttribute("user",name); and the next pahe when I do String user = (String) session.getAttribute("user"); it works but the page after that it gives null...
Hi Priya, Please post some code if possible. But otherwise, by the looks of it I think that you are getting a new session on every page, which could be due to that the client has disabled cookies and you also are not using URL rewriting. Thats what comes to my mind
-- HTML FORM HERE IS DISPLAYED AND I am not reredirected to LoginPage
-------------------------------------------------------------------- When the form is submitted ... It goes to Post Method of the servlet that the form calls...
I dont want a new session so I have this...
System.out.println("Prints this");
HttpSession mySession = request.getSession(false); if(mySession != null) { System.out.println("Got session"); user = (String) mySession.getAttribute("user"); } It doesnt print Got Session... If I set HttpSession mySession = request.getSession(true); -- It gives me a brand new session not the one from the previous page...
Thanks sam...Thank you you did lead me in the right direction.
Actually the client had cookies enabled but there was a option in WSAD which was under the WAS test server's web tab which has options for container... The enable URL Writing and Enable cookies were both disabled... I wonder why they do this?
In the Java Blueprints they recommend HTTPSession and so websphere should have atleast the Cookies option open by default ... But I guess we have to check that everytime...
Thank you again
The overall mission is to change the world. When you've done that, then you can read this tiny ad: