Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts design issues

 
Nems Vedek
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

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?

Thanks.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
     
    Vikrama Sanjeeva
    Ranch Hand
    Posts: 760
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi,

    For:

    - CreateNewUserAction
    - SaveNewUserAction
    - EditUserAction
    - SaveEditUserAction

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

    Bye,
    Viki.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic