struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "J. Garcia" <jogaco...@gmail.com>
Subject getText in error messages: resource bundle or bean value?
Date Fri, 19 Oct 2012 12:10:27 GMT
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