struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "J. Garcia" <jogaco...@gmail.com>
Subject Re: getText in error messages: resource bundle or bean value?
Date Fri, 19 Oct 2012 12:27:14 GMT
Mi mistake. Sorry.

The resource error message I was using is in fact:

errors.confirmPassSame=The ${user.confirmPassword} field has to have the
same value as the ${user.password} field.

whereas it should be:

errors.confirmPassSame=The ${getText("user.confirmPassword")} field has to
have the same value as the ${getText("user.password")} field.

Solved!


On Fri, Oct 19, 2012 at 2:10 PM, J. Garcia <jogaco.en@gmail.com> wrote:

> Hi,
> I'm having a problem with getText().
> I have the following xml validator:
>
>     <field name="user.confirmPassword">
>         <field-validator type="requiredstring">
>             <message key="errors.required"/>
>         </field-validator>
>         <field-validator type="fieldexpression">
>             <param name="expression">
>                 (user.confirmPassword.equals(user.password))
>             </param>
>             <message key="errors.confirmPassSame"/>
>         </field-validator>
>     </field>
>
> And the error message is defined in a bundle like this:
> errors.confirmPassSame=The ${getText(user.confirmPassword)} field has to
> have the same value as the ${getText(user.password)} field.
> ...
> user.confirmPassword=Confirm Password
> user.password=Password
>
> I would expect a message like:
> The Confirm Password field has to have the same value as the Password
> field.
>
> However, when the error message is shown, instead of the text from the
> resource bundle, what is shown are the actual values of the bean, like this:
> The abcd field has to have the same value as the 1234 field.
>
> Is this a bug in getText()?
>
> Cheers,
> J. Garcia
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message