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 Issue with multiple struts-config... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Issue with multiple struts-config... " Watch "Issue with multiple struts-config... " New topic
Author

Issue with multiple struts-config...

Easwar Murthi
Greenhorn

Joined: Jan 11, 2008
Posts: 3
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

Joined: Dec 27, 2007
Posts: 38
Hi Easwar

Can you please elabourate your problem.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

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 .


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

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 !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Issue with multiple struts-config...
 
Similar Threads
struts validation framework
Struts validation not working
Struts Validation Plug In
xdoclet and struts and validator
Struts validation[Very argent]