aspose file tools*
The moose likes Struts and the fly likes Can we place -validation.xml file in separate folder/package than corresponding Action file in xwork Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Can we place -validation.xml file in separate folder/package than corresponding Action file in xwork" Watch "Can we place -validation.xml file in separate folder/package than corresponding Action file in xwork" New topic
Author

Can we place -validation.xml file in separate folder/package than corresponding Action file in xwork

Krishna Bc
Greenhorn

Joined: Aug 24, 2010
Posts: 2


Hi All, I m working for service side POJO validation using xwork. I am having an action say ValidationAction.java and i have a corresponding xml file named ValidationAction-validation.xml having validation rules on fields.

As per specification and wherever i cud find,i have come to know that this xml file should be kept in the same package as the ValidationAction.java file. But since i do have many java files to go through validations and hence many corresponding xml files, i dont want to put them together in the same package. I want to have different folder/package for the xml files.

Is there any way out for this ??

Thanks and regards
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

As long as they're *deployed* correctly it doesn't matter where they live during development.
Krishna Bc
Greenhorn

Joined: Aug 24, 2010
Posts: 2
Hi David,
Thank you for your immediate reply.
I would like to be execusd for my ignorance.
I m trying to use xwork for the POJO validation as if i will execute a method to call the validate() method of ActionValidatorManager class. so no concern with server and deployment. I m trying to use it as a part of TestCase.

I even sniffed around the source code of DefaultActionValidatorManager class and there they are using the following code to find the corresponding xml file for the action object being supplied to the validate() method.

aClass.getName().replace('.', '/') + "-validation.xml";

So my hope got shedded after looking into the source code.

i even thought of creating my custom validatorManager class extending ActionValidatorManager class and just changing the code where its trying to find the validation xml file, but cudnt make it work out.

But i feel there must some other better and simpler way for doing this.

Please show the path.

Thanks and Regards.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Again, why go to all this trouble, when you simply need them on the classpath? it doesn't matter where they're located physically.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can we place -validation.xml file in separate folder/package than corresponding Action file in xwork