This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
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).]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!