• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

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

 
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);
 
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).]
 
Wanna see my flashlight? How about this tiny ad?
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic