aspose file tools
The moose likes Struts and the fly likes Newbie: How to get fields after Struts2 web form is submitted Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Newbie: How to get fields after Struts2 web form is submitted" Watch "Newbie: How to get fields after Struts2 web form is submitted" New topic
Author

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

Roberto Hernandez
Ranch Hand

Joined: Apr 29, 2009
Posts: 33
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

Joined: Sep 29, 2008
Posts: 12617

Then use a base class, or ModelDriven, or a property containing the common fields and additional properties on a per-action basis.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Newbie: How to get fields after Struts2 web form is submitted
 
Similar Threads
struts2
Struts2 checkboxes returning values in Action class
How to retain automatically generated fields on pageload in struts2
Struts2 - Difficulties in handling form data
Struts2