Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[struts 2] getting null on getSession

 
Jesus Angeles
Ranch Hand
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have implemented SessionAware, and I swear it ran yesterday, when I 'put' then 'get' a string into the session.

When I opened it up now, I now get null.

The session object itself is null.

Any ideas?


[ April 05, 2008: Message edited by: Jesus Angeles ]
 
Jesus Angeles
Ranch Hand
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I changed it to below.

Is this correct, or, is it like I am not supposed to instantiate it, and the struts framework will call the setSession?



Above doesnt work either.

Any comments on how to maintain sessions in Struts 2 without giving up testability (doing connections to container objects like ServletContext)?

[ April 05, 2008: Message edited by: Jesus Angeles ]
[ April 05, 2008: Message edited by: Jesus Angeles ]
 
Jesus Angeles
Ranch Hand
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I fixed it already.

I changed the setSession method to:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic