Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Issue with multiple struts-config...

 
Easwar Murthi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Will the use of Struts Modules help in eliminating this dependence?

Is it a good practice to create a new struts-config file for holding the validation xml entries alone?

What other approach can be done to eliminate this? Please help...

______________________________________

I have the following struts-config & validation xml files...
1) mf-struts-config.xml & mf-validation.xml
2) ky-struts-config.xml & ky-validation.xml
3) co-struts-config.xml & co-validation.xml
4) br-struts-config.xml & br-validation.xml
5) ct-struts-config.xml & ct-validation.xml

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?

[ September 04, 2008: Message edited by: Easwar Murthi ]

[ September 04, 2008: Message edited by: Easwar Murthi ]
[ September 04, 2008: Message edited by: Easwar Murthi ]
 
Kanchan Singh
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Easwar

Can you please elabourate your problem.
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 .

If this not what you want then Pl elaborate it more .
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Easwar Murthi:


I have the following struts-config & validation xml files...
1) mf-struts-config.xml & mf-validation.xml
2) ky-struts-config.xml & ky-validation.xml
3) co-struts-config.xml & co-validation.xml
4) br-struts-config.xml & br-validation.xml
5) ct-struts-config.xml & ct-validation.xml

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 !

Pl let me know whether this helps or not !
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic