Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session Tracking across doPost() & doGet()

 
Chinmay Bajikar
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • 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....
 
Asher Tarnopolski
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
post your code.
 
Chinmay Bajikar
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • 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.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic