Issue with multiple struts-config...

Easwar Murthi

Greenhorn

Posts: 3

posted 8 years ago

The application (consists of 5 small apps) that we currently have, has 5 struts-config files. The 5th struts-config xml is mentioned as the last in web.xml. Because of this, we are having to specify the validation xmls used in all the 5 apps. Because of this, the first app's validation xml entry resides in the fifth app's validation plug-in entry which is bad.

In web.xml i have the following entry.. <param-value> /WEB-INF/config/mf/mf-struts-config.xml, /WEB-INF/config/ky/ky-struts-config.xml, /WEB-INF/config/co/co-struts-config.xml, /WEB-INF/config/br/br-struts-config.xml, /WEB-INF/config/ct/ct-struts-config.xml </param-value>

Since i am loading the ct-struts-config.xml as the last, i am having to mention entries for all the validation xml into the validator plugin's 'pathnames' property. Otherwise, whatever xml i miss, the corresponding validations do not happen.

The same problem exists for the .properties file as well...

So I created a new struts-config file to hold the validation xml files.

Due to time constraints to test the entire app, we are not for creating a module for every single app...

Why is this dependence? Why doesnt it work when we have every validation xml in the corresponding struts xml??

Will only one instance of the validator plug-in be created? Is that why the 'pathnames' property is being over written every time a struts config file is loaded?

If you know How multiple struts module can be used with single Struts app, then you can solve your problem of multiple strut-config file , If not you can study Struts module from here (See section #5.3) and then you are able to solve or get some idea of your problem .

In web.xml i have the following entry.. <param-value> /WEB-INF/config/mf/mf-struts-config.xml, /WEB-INF/config/ky/ky-struts-config.xml, /WEB-INF/config/co/co-struts-config.xml, /WEB-INF/config/br/br-struts-config.xml, /WEB-INF/config/ct/ct-struts-config.xml </param-value>

Actually I don't have good knowledge of Struts Module , but as per Struts User Guide , the multiple module should be defined in DD as :

Here struts-default , is default , which comes as, when we have single module in our app , i.e No SwitchAction needed for this,

If you try this , I hope you wont require multiple entries of XX-validation.xml comma separated entries in <plug-in .. > tag .

Originally posted by Easwar Murthi:

Why is this dependence? Why doesn't it work when we have every validation xml in the corresponding struts xml??

Thats because Struts User guide suggest the way I put it above ! Pl check the URL again , It explains everything when more than one struts-config.xml file presents !