aspose file tools*
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


Win a copy of Spring in Action this week in the Spring forum!
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: 137
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
 
jQuery in Action, 2nd edition
 
subject: Regarding validation_rules.xml file