File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes multiple struts-config files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "multiple struts-config files" Watch "multiple struts-config files" New topic
Author

multiple struts-config files

jakes vandenberg
Greenhorn

Joined: Nov 05, 2004
Posts: 14
I have a struts based project (domain, ear, web) that I need to integrate with an existing project. This means that there will be multiple strut-config files, multiple ApplicationResources, etc.

Anyone done this before? What should I be concerned about? What about duplicate entries in both the struts-config files?

Any help is much appreciated.

Thanks
Jakes
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
There are two different ways to go here:

1-Create two different modules, each with their own Struts-config file and ApplicationResources file. This allows each module to have a degree of autonomy. This means it doesn't matter if both config files specify the same action path or action form name. Struts will still keep them straight.

2-Keep the applicaion as a single module with two config files. This will work, but if there are duplicate entries, the rule is the last entry wins, meaning that the one that is read last by the init process will be the one that is used. Also, while you can have more than one resource bundle file, you cannot have more than one default resource bundle. This means that the second and any subsequent resource files have to be defined with a key attribute, and referenced with a bundle attribute. Example:

<bean:message bundle="seconndbundle" key="mykey" />.


Merrill
Consultant, Sima Solutions
Seetesh Hindlekar
Ranch Hand

Joined: Feb 13, 2004
Posts: 244
Hi,

Pls refer to my post for multiple resource files in one struts-config.xml.

Rgds,

Seet
jakes vandenberg
Greenhorn

Joined: Nov 05, 2004
Posts: 14
I use the Application resources property file for error messages that I use to create and populate ActionMessages in my action. How do I tell it in the Action which property file to use??
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You don't. Unfortunately, there's no way to specify a non-default message resource when creating error messages.

The only way around this would be to write your own extensions to Struts.
[ October 20, 2006: Message edited by: Merrill Higginson ]
jakes vandenberg
Greenhorn

Joined: Nov 05, 2004
Posts: 14
Thanks for your help Merrill. Greatly appreciated.
 
Consider Paul's rocket mass heater.
 
subject: multiple struts-config files