• 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:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

session attributes disappearing mysteriously

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

I have a regular struts application that I am refactoring. I am setting a few attributes into session in an action class.

objHttpRequest.getSession().setAttribute("reportsDate", strWebReportDate);

The control than flows to the business classes, hits the DB and returns back to load a jsp. In the jsp when I try to read those variables, I get a null pointer exception.

String strReportDate = (String)session.getAttribute("reportsDate");

Does any body have any idea, what could be the possible reasons. I have checked that the values are not being reset nor is their any session.invalidate() call.
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible that strWebReportDate is null when you call setAttribute?

- Brent
 
I'm all tasted up for a BLT! This tiny ad wants a monte cristo!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic