I have a login.jsp which I use DynaValidatorForm. Both the username and password are 
required fields. When I submited the page without entering these data, I got 
"???en_US.errors.required???" and "???en_US.errors.required???". It looks like the 
validation was peformed because I got two error.required messages but I don't 
understand why it was not able to print the accurate message. please help. Thanks in 
adavance.

In xxxResources.properties:
errors.required={0} is required.
errors.minlength={0} cannot be less than {1} characters.
errors.maxlength={0} cannot be greater than {2} characters.
...

In struts-config.xml:
<form-beans>
  <!-- Login form bean -->
  <form-bean name="loginForm"
   type="org.apache.struts.validator.DynaValidatorForm">
     <form-property name="username" type="java.lang.String"/>
     <form-property name="password" type="java.lang.String"/>
  </form-bean>
</form-beans>

<message-resources parameter="xxxResources"/>

I packaged the xxxResource.properties in my xxx.war:
WEB-INF/classes/xxxResources.properties

In Validation.xml:
<form-validation>
  <formset>
    <form name="loginForm">
      <field property="username" depends="required,minlength,maxlength">
        <arg0 key="prompt.username"/>
        <arg1 key="${var:minlength}" name="minlength" resource="false"/>
        <arg2 key="${var:maxlength}" name="maxlength" resource="false"/>
        <var>
        <var-name>maxlength</var-name>
          <var-value>16</var-value>
        </var>
        <var>
          <var-name>minlength</var-name>
            <var-value>3</var-value>
        </var>
    </field>
    ......
</form>





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to