Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why cann��t get the original session object in second Servlet?

 
Quan Zhang
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why cann��t get the original session object in second Servlet?
Servlet1
HttpSession s1=request.getSession(false);
String id=s1.getId();
db.storeID(id);
Servlet2
String oldId=db.recoverID();
HttpSession s2=request.getSeession(false);
HttpSessionContext sc=s2.getSessionContext();
HttpSession oldS1=sc.getSession(oldId);
 
deepak adlakha
Ranch Hand
Posts: 325
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I first servlet you have to make the session object(true) instead of false and second servlet u have to keep the session (false).this means second servlet will use the session which is created by the first servlet(provided it's true there).
Pls try with this.This will work.
[This message has been edited by deepak adlakha (edited October 24, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic