• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem with session tracking

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you plz check where you are setting the value of "ssn" in session, is having some value or not?
 
Raj Neets
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Police line, do not cross. Well, this tiny ad can go through:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic