You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Otto, Frank" <ot...@delta-barth.de> on 2003/10/30 13:31:16 UTC

two resource bundles?!

Hi,
 
I have defined two properties files in my struts-config.xml:
 
<message-resource parameter="resource1"/>
<message-resource parameter="resource2" key="prop2"/>
 
If I want to access the second properties-file in a jsp-page I will use this:
 
<bean:message key="label.key" bundle="prop2"/>
 
It functions, but how must I use it in action classes?
 
// standard bundle
MessageResources res1 = (MessageRessource)request.getAttribute(Globals.MESSAGES_KEY)
 
// second bundle
MessageResources res2 = (MessageRessource)request.getAttribute(???)
 
 
Has anyone an idea?
 
 
 
Regards,
 
Frank

Re: two resource bundles?!

Posted by Manish Singla <Ma...@Sun.COM>.
Try this..
// second bundle
MessageResources res2 = (MessageRessource)request.getAttribute("prop2").

I assume you are not using struts modules.

see following also...
org.apache.struts.action.Action
protected MessageResources getResources(javax.servlet.http.HttpServletRequest request,
java.lang.String key)



"Otto, Frank" wrote:

> Hi,
>
> I have defined two properties files in my struts-config.xml:
>
> <message-resource parameter="resource1"/>
> <message-resource parameter="resource2" key="prop2"/>
>
> If I want to access the second properties-file in a jsp-page I will use this:
>
> <bean:message key="label.key" bundle="prop2"/>
>
> It functions, but how must I use it in action classes?
>
> // standard bundle
> MessageResources res1 = (MessageRessource)request.getAttribute(Globals.MESSAGES_KEY)
>
> // second bundle
> MessageResources res2 = (MessageRessource)request.getAttribute(???)
>
>
> Has anyone an idea?
>
>
>
> Regards,
>
> Frank


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


RE: two resource bundles?!

Posted by Navjot Singh <na...@net4india.net>.
not sure by might be 
Globals.MESSAGES_KEY + prop2


>-----Original Message-----
>From: Otto, Frank [mailto:otto@delta-barth.de]
>Sent: Thursday, October 30, 2003 6:01 PM
>To: Struts-User (E-Mail)
>Subject: two resource bundles?!
>
>
>Hi,
> 
>I have defined two properties files in my struts-config.xml:
> 
><message-resource parameter="resource1"/>
><message-resource parameter="resource2" key="prop2"/>
> 
>If I want to access the second properties-file in a jsp-page I 
>will use this:
> 
><bean:message key="label.key" bundle="prop2"/>
> 
>It functions, but how must I use it in action classes?
> 
>// standard bundle
>MessageResources res1 = 
>(MessageRessource)request.getAttribute(Globals.MESSAGES_KEY)
> 
>// second bundle
>MessageResources res2 = (MessageRessource)request.getAttribute(???)
> 
> 
>Has anyone an idea?
> 
> 
> 
>Regards,
> 
>Frank
>

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