struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MLENEV...@abusinessware.com
Subject RE [S2] How to have validation message using localization ?
Date Wed, 18 Apr 2007 16:22:22 GMT
Anyone ? :(


Michaël




Hi all,

With Struts 2.0.6, I try to have validation message with localization.

For example, I have a "login" form, with a "loginInput" input text :
<s:form action="login" validate="true" theme="xhtml">
<s:textfield label="%{getText('login.login')}" name="loginInput"/>
</s:form>

I have a validation on it :
<validators>
    <field name="loginInput">
        <field-validator type="requiredstring">
            <message key="errors.required"/>
        </field-validator>
    </field>
</validators>

And the "errors.required" is in my package.properties :
errors.required= The field "${getText(fieldName)}" is required !
login.login = Login

But this will displays : "The field "loginInput" is required !"

And I would like : "The field "Login" is required !". So I would like 
something which get the localization of my textfield label (login.login) 
to have localization in my error message, and not the field name, which 
does not say anything to the user :)

Could someone tells me how to do ?

Thanks a lot !

Regards,

Michaël.

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