Sample
Jsp
==============
<h1>Hi</h1>
<body>
<%
String user=(String)session.getAttribute("Name");
out.println(user);
%>
<form action="test.do" method="post">
Name :<input type="text" name="name" >
<input type="submit" value="Go">
</form>
</body>
==========
The above jsp calls this
servlet code
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
PrintWriter out = response.getWriter();
HttpSession session = request.getSession();
String user= request.getParameter("name");
session.setAttribute("Name",user);
}
===================
Put a value in Name field in jsp and submit the form.
Now invoke the jsp for the second time by opening a new tab the jsp displys the Name entered in for the first time in jsp.
The same does not work if we open a new window and try to invoke the same jsp.
Please clarify what is wrong with this code