aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Session Tracking problem.. Please help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Session Tracking problem.. Please help" Watch "Session Tracking problem.. Please help" New topic
Author

Session Tracking problem.. Please help

ramakrishna kulkarni
Greenhorn

Joined: Feb 06, 2009
Posts: 14
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
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9321
    
  17

The same does not work if we open a new window and try to invoke the same jsp.

Which browser are you using?? As far as I remember, IE8 has this capability and it might be achieved by adding an ad-on to the browser...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
ramakrishna kulkarni
Greenhorn

Joined: Feb 06, 2009
Posts: 14
It does not work with both IE6 and firefox
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session Tracking problem.. Please help