Could anybody let me know that why session attributes are not
thread?
I have written following
servlet public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException
{
response.setContentType("text/html");
String user = request.getParameter("user");
HttpSession session = request.getSession();
if(session.getAttribute("user")==null)
session.setAttribute("user",user);
PrintWriter out = response.getWriter();
out.println("session :"+session.getAttribute("user"));
}
When i open a browser and write
http://localhost:8080/chap5/testsession.do?user=pawan it displays
session : pawan
again when i open a new window (it means a new session attribute)
http://localhost:8080/chap5/testsession.do?user=bert it displays
session : bert
The second time : if(session.getAttribute("user")==null)
session.setAttribute("user",user);
again session attribute is null for id "user".
Could any body provide me a clear picture that how the same session attribute can be accessed when we open a new Broswer window and send a request for same.
Thanks in advance