You can use below code:
<form name="testForm">
<field property="oldPassword"
depends="required">
<arg0 key="testChangePassword.oldPasswordLabel"/>
</field>
<field property="newPassword"
depends="required,minlength">
<arg0 key="testChangePassword.newPasswordLabel"/>
<arg1 name="minlength" key="${var:minlength}" resource="false"/>
<var>
<var-name>minlength</var-name>
<var-value>4</var-value>
</var>
</field>
<field property="confirmNewPassword"
depends="required">
<arg0 key="testChangePassword.confirmNewPasswordLabel"/>
</field>
</form>
hello dear
do these things carefully
1. enable validator framework in struts config.xml file like this
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>
</struts-config>
2. in ur jsp where this password field is
inside title write
<html:javascript forName="some form bean name tht u have used instuts config file" >
inside <html:form action .... onsubmit="returnValidateFormBeanName(this);"> same as u use in the above line but do care its first letter should be capital.
NOw u have like in this jsp
<html:password property="password"> this property name will be used in validation.xml file.
in validation.xml write
<formset>
<form name="sameuused in strutsconfig and jsp file">
<field property="password"
depends="required">
<arg key="sameuused in strutsconfig and jsp file.password"/>
</field>
</form>
</formset>
then come to message resouce file property file
write
sameuused in strutsconfig and jsp file.password=Password
it will display the java script msg passwor is required
do these things properly
and it will work
this is clent side validaton
i will come to server side validation later
till that u do this
bye