Hi Denis,

> I'm using the i18n support in Struts in my applications, and am trying to
> localize my client-side Javascript validation messages using
> <bean:message/>.  I've tried
>
>    var msg='<bean:message key="login.error.username"/>';
>    alert(msg);
>
> and
>
>    alert(<bean:message key="login.error.username"/>);
>
> and many other combinations, none of which worked for me.  Has anyone been
> able to use <bean:message/> with Javascript?

It should work both forms. I've all my JavaScript messages localized that
way.
Check that you have set the locale init-param in your action servlet, in the
web.xml file:

    <servlet>
      <servlet-name>
        action
      </servlet-name>
      <servlet-class>
        org.apache.struts.action.ActionServlet
      </servlet-class>
...
      <init-param>
        <param-name>
          locale
        </param-name>
        <param-value>
          true
        </param-value>
...

Pierre Métras


Reply via email to