This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Struts and the fly likes Regarding validation_rules.xml file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Regarding validation_rules.xml file " Watch "Regarding validation_rules.xml file " New topic
Author

Regarding validation_rules.xml file

Johnson David
Greenhorn

Joined: May 22, 2005
Posts: 27
Hi All,

We all know that validation_rules.xml file contains all the validation functions like date,credit card,email etc.

My question is , Can we add our own functions to that file ?

If so, what is the procedure ?

thanks in advance,

Johnson
Paras Jain
Ranch Hand

Joined: Feb 26, 2005
Posts: 138
Yes you can very well do that.
Just define your own validating class and declare it in validator-rules.xml

you have to mention in the validator tag like this


<validator name="myvalidationrule"
classname="org.test.example.MyValidatorRule"
method="validateSomeRule"
methodParams="list of parameters"
depends=""
msg="errors.myvalidationrule"/>

in validation.xml say
<field property="blahblahblah" depends="myvalidationrule"></field>


Paras Jain
SCJP 5.0
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regarding validation_rules.xml file
 
It's not a secret anymore!