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

Multiple forms with one action class

 
Ambika Jain
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My application has 2 tabs and the user can add the details in both the tabs. But only when he clicks on "Save", which is in the first tab only, the info in both the tabs gets saved.
For such scenario is it a good idea to use 2 forms of the 2 tabs and one action class ?
Also does anyone has a sample program using multiple forms with one action class ?

Thanks
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While it's possible to have a single Action process two different ActionForms, it's not a clean solution, and I think it's better not to do it. You end up with a lot of if/else logic in your code, which can be cluttered and confusing.

If you do use the same action for the two different function, I'd suggest extending DispatchAction. This link explains more about how to do this.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic