You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by jonathan zhang <lo...@gmail.com> on 2005/02/22 01:39:43 UTC

problem with Application

I defined a file ApplicationResources.properties under 
com.xxx.software.xxx.resources, which contains the following lines:
prompt.password = "The password you entered does not satisfy the basic
requirement"
prompt.userName = "You must enter a user name"

in my struts-config i have 
<message-resources
parameter="com.titan.software.hsm.resources.ApplicationResources"
null="false"/>

in my validation.xml I have
<form-validation>
	<formset>

		<form name="logonForm">
			<field property="userName" depends="required">
			<arg0   key="prompt.userName"/>
			</field>
		
             <field property="password"
                    depends="required">
                <arg0   key="prompt.password"/>
         
            </field>  
		</form>

   </formset>   
</form-validation>

upon struts validation the javascript says 
"???en_US.errors.required???"
"???en_US.errors.required???"
which refers to the userName and password, does this mean the
validator are not getting prompt.userName and prompt.password ?
what am I doing wrong? i have been going the steps a couple of times
and can't find a loophole .  help me out here...
thanks

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


Re: problem with Application

Posted by Tim Christopher <ti...@gmail.com>.
The "???enUS.errors.required???" means that it's looking for an entry
in your properties file for errors.required but is unable to find one.

What you need to do is add something like:

#-- validation errors
errors.required={0} is required

#--diplay names
prompt.password = Password
prompt.userName = Username

/////////////////////////////////////
This means that for the following example:

<field property="password" depends="required">
      <arg0   key="prompt.password"/>
</field>

If an error is triggered by the "required"  validation, it will
automatically call "errors.required" in your properties file.  The {0}
in the definition of "errors.required" means that it should replace
{0} with the value of the key for arg0.  In this case the value for
this key is "Password".  Thus the final error message you will see is
"Password is required".

Hope that solves your problem.

Tim Christopher

On Mon, 21 Feb 2005 16:39:43 -0800, jonathan zhang <lo...@gmail.com> wrote:
> I defined a file ApplicationResources.properties under
> com.xxx.software.xxx.resources, which contains the following lines:
> prompt.password = "The password you entered does not satisfy the basic
> requirement"
> prompt.userName = "You must enter a user name"
> 
> in my struts-config i have
> <message-resources
> parameter="com.titan.software.hsm.resources.ApplicationResources"
> null="false"/>
> 
> in my validation.xml I have
> <form-validation>
>        <formset>
> 
>                <form name="logonForm">
>                        <field property="userName" depends="required">
>                        <arg0   key="prompt.userName"/>
>                        </field>
> 
>             <field property="password"
>                    depends="required">
>                <arg0   key="prompt.password"/>
> 
>            </field>
>                </form>
> 
>   </formset>
> </form-validation>
> 
> upon struts validation the javascript says
> "???en_US.errors.required???"
> "???en_US.errors.required???"
> which refers to the userName and password, does this mean the
> validator are not getting prompt.userName and prompt.password ?
> what am I doing wrong? i have been going the steps a couple of times
> and can't find a loophole .  help me out here...
> thanks
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

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