File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes [struts 2] getting null on getSession Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "[struts 2] getting null on getSession" Watch "[struts 2] getting null on getSession" New topic
Author

[struts 2] getting null on getSession

Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2046
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

Joined: Feb 26, 2005
Posts: 2046
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

Joined: Feb 26, 2005
Posts: 2046
I fixed it already.

I changed the setSession method to:

 
jQuery in Action, 2nd edition
 
subject: [struts 2] getting null on getSession
 
Similar Threads
How to iterate my vector...?
Session issue with Glassfish (Linux)
Probably Easy Struts2 Question - SessionAware
session management in struts2
How to display Dynamic Menus and sub-menus using <s:iterator> tag in struts