From: Tim <ti...@pa...> - 2004-05-28 22:31:26
|
On Friday 28 May 2004 10:52, Graeme J Sweeney wrote: > On Wed, 26 May 2004, Tim wrote: > > Hi, > > > > Been stuck for a little while on a disappearing session variable > > > > In one servlet (derived from a copy of WMServlet) > > I put my User object in the session something like this: > > > > void store(WebContext c, User myUser) { > > HttpSession s = c.getSession(); > > c.setAttribute("u", myUser); > > System.err.println(s.getAttribute("u")); > > } > > which prints out a valid User object > > > > However in the next servlet called > > HttpSession s = c.getSession(); > > System.err.println(s.getAttribute("u")); > > prints null > > <snip/> > > Do the session ids match on successive requests ? No, they are different. > > System.err.println("session.id="+s.getId()+"@session.new="+s.isNew()); Well I just did System.err.println("session+session); which prints out a different id for every servlet: org.apache.catalina.session.StandardSessionFacade@10ca208 org.apache.catalina.session.StandardSessionFacade@c7e8a7 thanks tim |