• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts validator Framework

 
Karthik Revanasiddan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

How do i validate the password field using mask rule. When I apply required and mask rule to the password field the required rule works but the mask rule does not work. How do i validate the password field
Am using <html assword/> tag.

regards,
karthik.
 
Rama Krishna Ghanta
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Karthik,

Let us know the mask rule you are using.If you use like mentioned below, then the password field will accept only alphabets in both Upper and Lower case.

<field property="newpassword" depends="required,minlength,maxlength,mask">
<arg0 key="prompt.password"/>
<arg1 key="${var:minlength}" name="minlength" resource="false"/>
<arg2 key="${var:maxlength}" name="maxlength" resource="false"/>
<var>
<var-name>minlength</var-name>
<var-value>6</var-value>
</var>
<var>
<var-name>maxlength</var-name>
<var-value>12</var-value>
</var>
<arg3 key="${var:mask}" name="mask" resource="false"/>
<var>
<var-name>mask</var-name>
<var-value>^[a-zA-Z]+$</var-value>
</var>
</field>


Regards,
Rama Krishna Ghanta
 
Karthik Revanasiddan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

<field property="userLogin.password" depends="required,mask">
<msg name="mask" key="errors.invalid"/>
<arg0 key="userLogin.initialPassword"/>
<var>
<var-name>mask</var-name>
<var-value>[..reg-expression...]</var-value>
</var>
</field>

In the above mentioned way I have mapped the password field to mask rule

regards,
karthik.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic