- This topic has 1 reply, 2 voices, and was last updated 19 years, 3 months ago by
Riyad Kalla.
-
AuthorPosts
-
yhqian2005MemberI have a struts 1.1 app that I want to use Validator Framework to validate the user input on the browser. This app will need user to enter username and password. These two fields are both required fields and the minlength and maxlength of password is 5 and 8.
I have myEclipse generate the validator-rules.xml, which means the validator of “required”, “minlength” and “maxlength” are generated automatically.
And the validation.xml is like this:
….
<form-validation>
<formset>
<form name=”logonForm”>
<field property=”username” depends=”required”>
<arg0 key=”LOGIN.FORM.USERNAME”/>
</field><field property=”password” depends=”required,minlength,maxlength”>
<arg0 key=”LOGIN.FORM.PASSWORD”/>
<arg1 name=”minlength” key=”${var:minlength}” resource=”false”/>
<arg1 name=”maxlength” key=”${var:maxlength}” resource=”false”/>
<var>
<var-name>minlength</var-name>
<var-value>5</var-value>
</var>
<var>
<var-name>maxlength</var-name>
<var-value>8</var-value>
</var>
</field></form>
</formset>
</form-validation>When I test my app, only the “required” validator is working, and I got a popup which says
“The user name is required. The password is required.”. The problem is I did not get any message about the minlength and maxlength validation in the popup when I input a password with length 3 and 11.Why only the “requred” validator work?
I really appreciate!
Riyad KallaMemberyhqian2005,
Unfortunately we don’t have any in-house expertise with the validation framework, so I don’t know that we could answer your question. Have you tried asking on the Struts mailing lists? Or checking for other folks using validation in the Sun forums (http://forums.java.sun.com) -
AuthorPosts