Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Newbie: How to get fields after Struts2 web form is submitted

 
Roberto Hernandez
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not very familiar with the struts2 framework yet, so I need your help on this scenario.
I have a form in a jsp with 15 fields. Once I submit the form, the request is passed on to the action and my question is "How do you get a hold of those fields (values).
I have read in many tutorials that you have to use getters and setters for each field and that works, but I think it's kind of cumbersome to do this for each form that I have because the same form fields will be used in multiple forms throughout the application and I don't want to have the same getters and setters declared in multiple places.

Is there a way to avoid this? Please please help!!!
Thanks,
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then use a base class, or ModelDriven, or a property containing the common fields and additional properties on a per-action basis.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic