[prev in list] [next in list] [prev in thread] [next in thread] 

List:       struts-user
Subject:    Re: How to use locale attribute in struts:message
From:       "Craig R. McClanahan" <Craig.McClanahan () eng ! sun ! com>
Date:       2000-12-28 22:04:55
[Download RAW message or body]

Jorge Kazuo wrote:

> Could anyone send me a example on how to use locale attribute in
> struts:message ?
>

The "locale" attribute is used to name the session bean containing a
java.util.Locale object used to select the language of the resulting message.

Assume you've executed the following code in an Action:

    Locale locale = new Locale("en", "US");
    session.setAttribute("usenglish", locale);

Now, you can use the following tag in a JSP page to pull the message in US
English, no matter what locale the user has currently selected:

    <bean:message key="messagekey" locale="usenglish"/>

If you don't specify a "locale" attribute, Struts looks up the locale stored
under the default bean name (the value of the constant string
Action.LOCALE_KEY), which is normally used to allow your users to select their
own preferred language.

>
> TIA
>

Craig McClanahan

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic