You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nguyen Xuan Son <ya...@gmail.com> on 2009/12/02 07:15:46 UTC

comparing in validation.xml file

dear all
in C0003_ChangePasswordAction-validation.xml
i would like to compare the new password and the retype new password in
order to identify whether they are the same or not
however so far i only know to validate the specified field only, such as
<validators>
<field name="oldPass">
<field-validator type="requiredstring">
<param name="trim">true</param>
<message>error</message>
</field-validator>
</field>
 <field name="newPass">
<field-validator type="requiredstring">
<param name="trim">true</param>
<message>error</message>
</field-validator>
</field>
 <field name="retype">
<field-validator type="requiredstring">
<param name="trim">true</param>
<message>error</message>
</field-validator>
</field>
</validators>
please tell me what should i do if i want to work with more than
one validated fields
thank you very much

-- 
=======================================================================
Ritsumeikan University, Asia JinZai Project
Master of Information Science
Nguyen Xuan Son

Add       : Japan, Shiga-Ken, Kusatsu-Shi, Kasayama 3choume 1-18 ShiteiHaimu
Rien, Room 103
Tel/Fax  : 81-(0)90-3976 2246
Email    : nr0003xx@ed.ritsumei.ac.jp
Mobile   : 81-(0)90-3976 2246          URL  : http://www.ritsumei.jp
=======================================================================

Re: comparing in validation.xml file

Posted by Greg Lindholm <gr...@gmail.com>.
If you look at the Validation Guide [1] you will find a link at the
bottom for WebWork Validation [2] which shows this example for
comparing passwords.

 <field name="user.password">
    <field-validator type="requiredstring">
      <message key="user.password.empty"/>
    </field-validator>
  </field>
  <field name="user.confirmPassword">
    <field-validator type="requiredstring">
      <message key="user.confirmPassword.empty"/>
    </field-validator>
  </field>
  <validator type="expression">
    <param name="expression">
      user.password.equals(user.confirmPassword)</param>
    <message key="user.confirmPassword.nomatch"/>
  </validator>


[1] http://struts.apache.org/2.x/docs/validation.html
[2] http://today.java.net/pub/a/today/2006/01/19/webwork-validation.html


On Wed, Dec 2, 2009 at 1:15 AM, Nguyen Xuan Son <ya...@gmail.com> wrote:
>
> dear all
> in C0003_ChangePasswordAction-validation.xml
> i would like to compare the new password and the retype new password in
> order to identify whether they are the same or not
> however so far i only know to validate the specified field only, such as
> <validators>
> <field name="oldPass">
> <field-validator type="requiredstring">
> <param name="trim">true</param>
> <message>error</message>
> </field-validator>
> </field>
>  <field name="newPass">
> <field-validator type="requiredstring">
> <param name="trim">true</param>
> <message>error</message>
> </field-validator>
> </field>
>  <field name="retype">
> <field-validator type="requiredstring">
> <param name="trim">true</param>
> <message>error</message>
> </field-validator>
> </field>
> </validators>
> please tell me what should i do if i want to work with more than
> one validated fields
> thank you very much
>
> --
> =======================================================================
> Ritsumeikan University, Asia JinZai Project
> Master of Information Science
> Nguyen Xuan Son
>
> Add       : Japan, Shiga-Ken, Kusatsu-Shi, Kasayama 3choume 1-18 ShiteiHaimu
> Rien, Room 103
> Tel/Fax  : 81-(0)90-3976 2246
> Email    : nr0003xx@ed.ritsumei.ac.jp
> Mobile   : 81-(0)90-3976 2246          URL  : http://www.ritsumei.jp
> =======================================================================

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org