my dog learned polymorphism*
The moose likes Struts and the fly likes Session bean in Struts 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Session bean in Struts 2" Watch "Session bean in Struts 2" New topic
Author

Session bean in Struts 2

Nigel King
Greenhorn

Joined: Mar 03, 2006
Posts: 29
Hi,

I'm relatively new to Struts 2 and am trying to create a session bean that will hold a list of manufacturers.
In a JSP using Struts 1 tags I might do something like

to set the bean from an already defined service bean.
Is there an equivalent in Struts 2? Or am I looking at another method of achieving the same?

Thanks in advance.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Well, I'm not convinced that kind of logic belongs in the JSP page. If you already have the manufacturers available then why not just do it in the action? IMO the view layer shouldn't be responsible for defining application-wide behavior.
Nigel King
Greenhorn

Joined: Mar 03, 2006
Posts: 29
Thanks, David. You make a good point.
I'll do it that way instead.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

(I should have answered the question anyway; the equivalent tag would be <s:set>, although to be honest I've never used it to do anything other than create action-scoped temporary variables.)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session bean in Struts 2
 
Similar Threads
checking for bean in session
Calling action without form (Struts)
logic:notPresent question
bean value persists on clicking back
How to use s:set in Struts 2