File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem regarding validation

 
Vasudhaiv Naresh
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic