*
The moose likes Servlets and the fly likes problem with session tracking Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "problem with session tracking" Watch "problem with session tracking" New topic
Author

problem with session tracking

Raj Neets
Ranch Hand

Joined: Nov 12, 2002
Posts: 46
Hello Everyone
I have a problem with HttpSession tracking.Here is the piece of code that iam working on
HttpSession session = request.getSession(true);
session.setAttribute("ssn",ssn);
String tt=(String)session.getAttribute("ssn");
System.out.println("**********"+tt);

response.sendRedirect(response.encodeURL("employee_option.html"));
// rd = getServletContext().getRequestDispatche("/employee_option.html");
//rd.forward(request,response);
My problem is, from a servlet iam calling a HTML page, then from that HTML page iam calling another servlet.iam trying to creating a session in the frist servlet and get it back in the second servlet.But getAttribute() method returns Null in second servlet.so for debugging i used getAttribute()[shown in the code],it also returns NULL value in the same servlet.Iam working with weblogic7 server.Can some please tell me where iam going wrong.
Thanx
Raj.
swapna Kadali
Greenhorn

Joined: Oct 06, 2003
Posts: 22
Hello Raj,
Ofcourse I am new to java, I had a similar problem while working with servlets with JSP. I think you have to uncomment the requestdispatcher code and then try. Hope it works, I am not sure. sorry
HttpSession session = request.getSession(true);
session.setAttribute("ssn",ssn);
String tt=(String)session.getAttribute("ssn");
System.out.println("**********"+tt);
response.sendRedirect(response.encodeURL("employee_option.html"));
// rd = getServletContext().getRequestDispatche("/employee_option.html");
//rd.forward(request,response);
// rd = getServletContext().getRequestDispatche("/employee_option.html");
Raj Neets
Ranch Hand

Joined: Nov 12, 2002
Posts: 46
Hello Swapna
I tried doing that but it didn't work.
Is there anything that has to be enabled in weblogic to supports Session tracking.
thanx
Raj
Sanjeev Kaushik
Ranch Hand

Joined: Aug 01, 2002
Posts: 105
Can you plz check where you are setting the value of "ssn" in session, is having some value or not?


Sanjeev Kaushik
Raj Neets
Ranch Hand

Joined: Nov 12, 2002
Posts: 46
Excellent Sanjay
Thank you very much, by mistake i was not assigning correct value to the variable ssn.so it was taking null value.
Really help me, i never thought of checking the variable ssn.
Thank you very much.
Raj
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with session tracking