• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Strange Problem with Sessions

 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I m putting a vector in a session on my first page which is a dynamic html generated by the output of a servlet
like this
HttpSessiom session = req.getSession(true);
session.putValue("MyVector",obj);
where Vector is declared at class level in this way
Vector obj = new Vector();
If i try to retrive the vectors value in my second page by this way
HttpSession ses = req.getSession(true);
Vector obj = (Vector)ses.getValue("MyVector");
when i run my application first time it retrives the value of obj in second application as null but when i refresh the browser and again call the second application from first then it runs perfectly fine
Can anyone suggest where I m going wrong?
any views ?

 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I dont know if this will help but try

from what I understand, the way you did it will only create a new session if one doesnt exist. So shouldnt be a problem, but its worth a try I suppose.
I did the same thing using ArrayList and had no problem. I hope you find solution.
[This message has been edited by Randall Twede (edited February 27, 2001).]
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm willing to bet that you're running into browser caching. If you're using IE, try Internet Options -> Temporary Internet Files Settings -> Every visit to the page. If that works, add headers to your response to disable caching.
- Peter
 
reply
    Bookmark Topic Watch Topic
  • New Topic