Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session bean in Struts 2

 
Nigel King
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, David. You make a good point.
I'll do it that way instead.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(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.)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic