You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Chen, Vivien" <Vi...@DigitalNet.com> on 2003/10/10 15:48:23 UTC

Please help with this error "???en_US.errors.required???"

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>






Re: Please help with this error "???en_US.errors.required???"

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
On 10/10/2003 03:55 PM Daniel H. F. e Silva wrote:
> Hi Vivien,
> 
>   Take a look at your web.xml. Maybe you copied it from Struts dist and message-resources was
> already configured there. As settings in web.xml will override settings in struts-config.xml, 
> classloader can't find resource to be loaded and then you get that messages.
>   Hope i helped you.
> 
> Kind regards,

Hi Daniel,
do you use JSTL as well as struts taglibs?  I was wondering how you 
would configure multiple 'localization contexts' in web.xml for use by 
different JSTL taglibs.

And if so, how do you make one the default?

Adam

e.g.

   <context-param>
     <param-name>
       javax.servlet.jsp.jstl.fmt.localizationContext
     </param-name>
     <param-value>ApplicationResources</param-value>
   </context-param>

-- 
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9


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


Re: Please help with this error "???en_US.errors.required???"

Posted by "Daniel H. F. e Silva" <dh...@yahoo.com>.
Hi Vivien,

  Take a look at your web.xml. Maybe you copied it from Struts dist and message-resources was
already configured there. As settings in web.xml will override settings in struts-config.xml, 
classloader can't find resource to be loaded and then you get that messages.
  Hope i helped you.

Kind regards,
 Daniel.


--- "Chen, Vivien" <Vi...@DigitalNet.com> wrote:
> 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: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org


__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

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