jQuery in Action, 3rd edition
The moose likes Struts and the fly likes Struts design issues Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts design issues" Watch "Struts design issues" New topic

Struts design issues

Nems Vedek

Joined: Sep 26, 2005
Posts: 9

as my projects using struts are getting bigger I started to wonder about few design issues.

One thing I've noticed is that if the project is using lot of forms, I end up having even more actions.

For example:

- CreateNewUserAction
- SaveNewUserAction
- EditUserAction
- SaveEditUserAction

and the list goes on and on.

Is this ok or should I learn to use DispatchAction or is there any other approach?

Second thing I have been wondering is the i18n-issue. So far I've been using the ApplicationResources.properties file for each language. For me it is not a big issue to hack the .txt-file but let's assume that the customer want's to edit it. Should I just dump the whole AppRes.pro-file and do the localization in DB? If so, how can I maintain the automatic language selection with the browser?

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I don't see that having a large number of classes is a problem. As long as it's easy to recognize which action class goes with which page, and they're well organized into packages according to function, there's nothing to worry about. If you find that you're repeating the same code in multiple actions, you may want to consider creating a base action class from which to extend your other actions.

Regarding your i18n questions, there are two things to consider:
  • The ApplicationResources files are loaded only when the web application starts up. Any changes to these files will not be reflected until the application is restarted.
  • If you create a user interface to change your ApplicationResources files, the user will not see the changes until after the application is restarted

  • If you decide to use a database instead of the ApplicationResources files, it is possible to determine the locale of the user. See This thread for details.

    Consultant, Sima Solutions
    Vikrama Sanjeeva
    Ranch Hand

    Joined: Sep 02, 2001
    Posts: 756


    - CreateNewUserAction
    - SaveNewUserAction
    - EditUserAction
    - SaveEditUserAction

    See Rick's site for CRUD (Create, Retrieve, Update, Delete) Lesson. here. This is good example showing usage of DispatchAction.


    Count the flowers of your garden, NOT the leafs which falls away!
    Prepare IBM Exam 340 by joining http://groups.yahoo.com/group/IBM340Exam/
    I agree. Here's the link: http://aspose.com/file-tools
    subject: Struts design issues
    jQuery in Action, 3rd edition