aspose file tools*
The moose likes Struts and the fly likes Session Object in struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Session Object in struts2" Watch "Session Object in struts2" New topic
Author

Session Object in struts2

sarada bokka
Ranch Hand

Joined: Jan 13, 2010
Posts: 80
I have tried the example to get session object from [url]http://www.roseindia.net/struts/struts2/struts2ajax/struts2-session.shtml
[/url]
Instead of using SessionAware
i tried to get session object as below
ActionContext context =ActionContext.getContext();
context.getSession().put("ret", "welcome1")

It was not working.

Can we get the session object in such a way?
if it is possible i am unable to get the result in JSP page.
<s:property value="#session.ret" />
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Using SessionAware is a better way to do this, though.

Without knowing more about the flow, config, and code, it'll be hard to help--what you're doing should work.
sarada bokka
Ranch Hand

Joined: Jan 13, 2010
Posts: 80
Sorry for the above post . There was a logical error in my code.

Both are working fine

1)Implementing SessionAware

2)ActionContext context=ActionContext.getContext();
context.getSession().put("ret", "welcome1")

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

No apologies necessary :)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session Object in struts2