This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have 2 servlets "servletA" and "servletB". there are 2 jsp pages "page1.jsp" and "page2.jsp".
when a user clicks a button on page1.jsp, servletA is executed, and then user is redirected to page2.jsp.
On page2.jsp, there is another button which corresponds to servletB. Now I need to set an atrribute in servletA and access the value of that in servletB.
So, I used session.setAttribute("att","abc") in servletA.
Now I retrieve the value of att in servletB as (String)session.getAttribute("att").
Now the problem is that,
When I run the webapplication it almost works well.
But occasionally, (String)session.getAttribute("att") is returning NULL. This happens 2 times out of 10 times.
I tried to print the session.Id values in both servlets, both are returning different values when this error occurs.
A single user will have only one session. But why am I getting different session.Id occasionally?
Can anyone help me with this?