Right design for struts application

please help me making a good design in the following situation.
1. There will be one web page containing some data. There are many actions associated with this data - say add/edit/delete/modify etc. There are different buttons for each of these actions. Now tell me what will be the right struts design for it? How many forms should I have and how many action classes?

2. There is the same webpage as in 1 above. But this time, I have an advanced button also. So clicking this opens advanced properties in the same page and saving them shoudl return to the same page as before. Here, how should I go about the design.

Any help is appreciated. Thanks
Who is Participating?
TimYatesConnect With a Mentor Commented:
This is how I would do it...

1)  Have a single ActionForm containing your data, and a property that is set depending on which button is pressed (you can tie each submit button to the same property, so by reading this property, you can tell which button has been pressed) Have a look at http://j2ee.lagnada.com/struts/html-buttons.htm for a good example of how to use multiple buttons to post the same form.  This means that you will only have one action as well, with multiple "if" statements dependant on which button was clicked :-)

2)  I usually do this with a DIV section...  shen the "advanced" checkbox is selected, set the style visibility to visible on the div that contains all of the advanced options (a collection of checkboxes?) And have each of these tied to a property in your same form (so you still have one form)...  You can then read these properties too inside the single action... ie:

if( properties.contains( "advanced" ) && properties.contains( "someAdvancedThing" ) )
  // do advanced stuff...

Maybe someone else will have a better way of doing this though (that relies less on javascript)

Good luck!

kumvjuecAuthor Commented:
hi Tim,

Can there be any problems if the same ActionForm is shared by more than 2 html pages or between two action classes?
Shouldn't be...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.