aspose file tools*
The moose likes Struts and the fly likes problem regarding validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "problem regarding validation " Watch "problem regarding validation " New topic
Author

problem regarding validation

Vasudhaiv Naresh
Ranch Hand

Joined: May 13, 2005
Posts: 57
Hi all!
I'm new to Struts. I was trying to implement validations using :
1. validation.xml
2. validation-rules.xml

I've a form bean, named 'userRegistrationForm', declared in the struts-config.xml. This form bean is mapped to the "UserRegistrationForm" which extends the "ValidatorForm" class. I've not defined the validate() method, since its already implemented in the super class(ValidatorForm).
I've set the following in the validation.xml :

_________________________________________________________
<form name="userRegistrationForm">
<field property="firstName" depends="required">
<arg key="userRegistrationForm.firstName" />
</field>
.
.
.
</form>
________________________________________________________


Also I've made the necessary plugin declarations required to enable the validation using :

______________________________________________________________
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property
property="pathnames"
value={paths} />
</plug-in>
______________________________________________________________


Upon deploying, I found that even when the "first name" field or any other field is left blank, an error message is not being displayed.
Please let me know if I'm wrong or if I'm missing something.
Thanks,
Naresh
Vasudhaiv Naresh
Ranch Hand

Joined: May 13, 2005
Posts: 57
hi all!

the source for the userRegistration.jsp file is as follows :


When I submit the form, a javascript error saying :
" user_required not found ".
Upon debugging it was found that,
the generated javascript has a function : "userRegistrationForm_required"
upon debugging i found instead of this function, some user_required() is being called, and hence the error.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem regarding validation
 
Similar Threads
How to use Validators
Need step by step procedure to use Validation framework
Struts validation not displaying error messages
Form validation in struts
Another "Validator Plugin" Problem