This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Struts design issues  RSS feed

 
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.
 
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.
     
    Ranch Hand
    Posts: 765
    • 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.
     
    What does a metric clock look like? I bet it is nothing like this tiny ad:
    how do I do my own kindle-like thing - without amazon
    https://coderanch.com/t/711421/engineering/kindle-amazon
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!