• 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

Session Tracking across doPost() & doGet()

 
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a Login page from where I Login.
The submit for this login is being handled by the doPost() of servlet.Here i set the session with the Loginid and passwd in it.
Then I have another page which asks for information from the server.The submit for this form will call doGet() and this in turn tries to get the session which has been currently set thru doPost().But what I m getting is a diff session with the heetsession.getValueNames() returning 0 length String[].
Can anyone tell me why this is happening?
thanks in adv,
Chinmay....
 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
post your code.
 
Chinmay Bajikar
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I did get over the problem.But I dont understand how.
Here is what I did?
My login page called the Servlet in this way,
<form action="http://192.146.0.20:8080/servlet/MyServlet" method=Post>
Where "192.146.0.20" is the ip of my machine.
But the page which did a get , call my servlet in this way,
<form action="http://localhost:8080/servlet/MyServlet" method=Get>
What differance does this make for Session Management,since both localhost and 192.146.0.20
point to the same machine?
Conclusion:- Problem Solved But Not Understood.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They are the same machine, but the browser can't tell that. It will only send the session id if it can verify that they are the same server. even if you send the domain name in some links and the IP in others you will still lose the session.
Dave
reply
    Bookmark Topic Watch Topic
  • New Topic