struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hoying, Ken" <Ken_Hoy...@PremierInc.com>
Subject RE: getText in error messages: resource bundle or bean value?
Date Fri, 19 Oct 2012 12:54:33 GMT
I believe that your problem is that the field names are the same as your label names and with
the validator both are in the stack. ${getText(user.password)} is first evaluating user.password
and finding the field value "1234".  getText is then trying to locate an entry for "1234"
and cannot find one so it is just return "1234".

It might work if you try ${getText('user.password')}.  Otherwise, you may need to rename it.

-----Original Message-----
From: J. Garcia [mailto:jogaco.en@gmail.com] 
Sent: Friday, October 19, 2012 8:10 AM
To: Struts Users Mailing List
Subject: getText in error messages: resource bundle or bean value?

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

-----------------------------------------
***Note:The information contained in this message may be privileged and confidential and protected
from disclosure. If the reader of this message is not the intended recipient, or an employee
or agent responsible for delivering this message to the intended recipient, you are hereby
notified that any dissemination, distribution or copying of this communication is strictly
prohibited.  If you have received this communication in error, please notify the Sender immediately
by replying to the message and deleting it from your computer.  Thank you.  Premier Inc.



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


Mime
View raw message