Right design for struts application

Posted on 2004-11-08
Last Modified: 2010-04-06
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
Question by:kumvjuec
    LVL 35

    Accepted Solution

    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 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!

    LVL 3

    Author Comment

    hi Tim,

    Can there be any problems if the same ActionForm is shared by more than 2 html pages or between two action classes?
    LVL 35

    Expert Comment

    Shouldn't be...

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Suggested Solutions

    Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
    Preface In the first article: A Better Website Login System ( I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
    Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
    The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now