The Struts source code itself offers many examples of how to
programatically access localized text from a mesage bundle.  The
MessageResources class is the key to this -- it's also the code used
by tags like <bean:message> for ths purpose.

For example, here's some snippets from how one might use a
MessageResources instance to localize the text for a particular
result:

    // MessageResources bundle for this application
    protected static MessageResources messages =
      MessageResources.getMessageResources("com.mycompany.MyBunde");

    ...

    // Look up an message string using the Locale for this request
    Locale locale = (Locale) request.getAttribute(Globals.LOCALE_KEY);
    String text = messages.getMessage(messages, "some.message.key");


Craig


On Fri, 22 Oct 2004 08:48:16 -0700 (PDT), Ashish Kulkarni
<[EMAIL PROTECTED]> wrote:
> Hi
> I am working on a struts application, In this a Action
> class calls a java class which does all the business
> logic, then this java class returns a ArrayList which
> has
> 1 Completion flag, 0 successfull, 1 error
> 2 All messages to be displayed
> 3 Data for jsp screen
> 
> These messages generated due to problem with data for
> business logic, for example value cannot be 2 if user
> = ABC
> I want these messages to be Internationalized,  I will
> define these messages in resource file, and generate
> them in this java class
> What is the best way of doing it, i want these java
> classes to be decoupled from struts, so can be used in
> any web application.
> What will be the best way to do so
> Ashish
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail Address AutoComplete - You start. We finish.
> http://promotions.yahoo.com/new_mail
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to