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 Struts Validator Framework Error ...Depends String is not Found in validator-rules. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Validator Framework Error ...Depends String is not Found in validator-rules. " Watch "Struts Validator Framework Error ...Depends String is not Found in validator-rules. " New topic
Author

Struts Validator Framework Error ...Depends String is not Found in validator-rules.

Rahul Nair
Ranch Hand

Joined: Dec 01, 2007
Posts: 138
Hi,

I am using struts validation framework for validating my fields....I use custom validation class to validation my fields for Number...
when i try to run application it shows following error...

" java.lang.NullPointerException: Depends string "cNumber" was not found in validator-rules.xml. "

my validation file entry is...

<field property="phoneNumber"
depends="cNumber">
<arg key="form.Number"/>
</field>

and validation rules.xml entry is ...

<validator name="cNumber"
classname="com.myApp.ContactNumberValidator"
method="validateContactNumber"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages,
org.apache.commons.validator.Validator,
javax.servlet.http.HttpServletRequest"
depends=""
msg="errors.contactNumber"/>


I am not getting what is wrong with my code....

Please help me ?

Thanks

Rahul...
Alaa Nassef
Ranch Hand

Joined: Jan 28, 2008
Posts: 460
It seems OK to me. Just make sure that you are using this validation rules file and that you set its location correctly in the validation plugin definition. I know that it's elementary, but I sometimes do much more stupid things


Visit my blog: http://jnassef.blogspot.com/
Rahul Nair
Ranch Hand

Joined: Dec 01, 2007
Posts: 138
Thanks Alaa,

But if i remove above validation rule then the rest form filed validation is working fine through same validation files in my application....

And It is says Depends string not found in Validation-rules.xml file.....

I Had correctly mapped the validation rule cNumber in my validation file...

Please help if someone knows about this...

Thanks

Rahul...
Rahul Nair
Ranch Hand

Joined: Dec 01, 2007
Posts: 138
Hi,

Please Help me, if someone know about above issues....

Thanks


Rahul.
Blade Fish
Greenhorn

Joined: Jul 24, 2008
Posts: 1
hey,

you might want to remove the depends tag in the validator-rules.xml file.
It should ideally look like

<validator name="cNumber"
classname="com.myApp.ContactNumberValidator"
method="validateContactNumber"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages,
org.apache.commons.validator.Validator,
javax.servlet.http.HttpServletRequest"
msg="errors.contactNumber"/>

try and see if this works.

Thanks,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts Validator Framework Error ...Depends String is not Found in validator-rules.
 
Similar Threads
Help to add validation
Another "Validator Plugin" Problem
Problems wih validateUrl method
CustomValidation is not working ???
validaion.xml and validaton-rules.xml file not calling