You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Sr...@iflexsolutions.com on 2004/04/21 14:56:01 UTC

Struts Problem - Urgent Help Required

Hi All,

 

I have a problem in struts development. I have to generate content from
a custom tag. but I want to display the labels in multilingual format
for which I need to use <bean:message /> tag.

But from a custom tag we can't use another tag like
out.println("<bean:message..../>")

This will be executed/evaluated as a string not as a tag.

 

How do I access "a message associated with a key in application
resources file programmatically"?

 

Plz kindly provide me a approach to come out of this problem.

 

Regards,

M.Srinivas Amarnadh

i-Flex Solutions Ltd., 

4th Floor, Shankar Narayana building,

M G Road,

Bangalore - 560001.

Phone: +91-80-25321440, x: 3887.

 


Re: Struts Problem - Urgent Help Required

Posted by "Manfred Wolff (neusta)" <ma...@manfred-wolff.de>.
better is struts user list ;-)

You need to get the MessageResources object, which is saved in the 
session and in the request under the key Globals.MESSAGES_KEY. If you 
have this object you can call the method

message = resources.getMessage(userLocale, key);

or

message = resources.getMessage(userLocale, key, args);

als you will.


In tags you can use the TagUtil class TagUtils and you can call the 
message message

    /**
     * Look up and return a message string, based on the specified 
parameters.
     *
     */
    public String message(
            PageContext pageContext,
            String bundle,
            String locale,
            String key)
            throws JspException {
    }

Manfred Wolff

Srinivas.Amarnadh@iflexsolutions.com wrote:

>Hi All,
>
> 
>
>I have a problem in struts development. I have to generate content from
>a custom tag. but I want to display the labels in multilingual format
>for which I need to use <bean:message /> tag.
>
>But from a custom tag we can't use another tag like
>out.println("<bean:message..../>")
>
>This will be executed/evaluated as a string not as a tag.
>
> 
>
>How do I access "a message associated with a key in application
>resources file programmatically"?
>
> 
>
>Plz kindly provide me a approach to come out of this problem.
>
> 
>
>Regards,
>
>M.Srinivas Amarnadh
>
>i-Flex Solutions Ltd., 
>
>4th Floor, Shankar Narayana building,
>
>M G Road,
>
>Bangalore - 560001.
>
>Phone: +91-80-25321440, x: 3887.
>
> 
>
>
>  
>


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