You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by th...@polaris.co.in on 2003/05/29 07:51:49 UTC

Can I have more than one properties file and retrieve from them based on the context

Hi,

   I am using struts <bean:message/> tag to retrieve messages from
properties file. I need to specify the properties file name in web.xml
for the action servlet. Can I have more than one properties file and
retrieve it from the properties file by specifying some identifier.

   For e.g., <bean:message key="xx.xx" file="xx"/>.

Regards,
Thiru


Re: Can I have more than one properties file and retrieve from them based on the context

Posted by Sakis Chatzinikolaou <sh...@upatras.gr>.
Hi Thiru,

No, you just have to set the language in the request and it opens the right
properties file
on its own.
setLocale(request, new Locale(language, country))
in an action class

Hope this helps
Sakis

----- Original Message -----
From: <th...@polaris.co.in>
To: <st...@jakarta.apache.org>
Sent: Thursday, May 29, 2003 8:51 AM
Subject: Can I have more than one properties file and retrieve from them
based on the context


Hi,

   I am using struts <bean:message/> tag to retrieve messages from
properties file. I need to specify the properties file name in web.xml
for the action servlet. Can I have more than one properties file and
retrieve it from the properties file by specifying some identifier.

   For e.g., <bean:message key="xx.xx" file="xx"/>.

Regards,
Thiru




----------------------------------------------------------------------------
----


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


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


Re: Can I have more than one properties file and retrieve from them based on the context

Posted by Gareth Andrew <ga...@ntlworld.com>.
Hi,

Yup, you can have as many <message-reosurces> entries in 
struts-conffig.xml as you want (each with a different 'key' attribute), 
then in <bean:message> you can specify which properties file you want 
with the attribute bundle.

http://jakarta.apache.org/struts/userGuide/configuration.html#resources_config
http://jakarta.apache.org/struts/userGuide/struts-bean.html#message

HTH,

Gareth.

PS.  Does anyone know if referencing properties in web.xml like so

|<param-name>application</param-name>
<param-value>
    com.mycompany.mypackage.MyResources
</param-value>
|

deprecated by <message-resources>????

Hi,

>   I am using struts <bean:message/> tag to retrieve messages from
>properties file. I need to specify the properties file name in web.xml
>for the action servlet. Can I have more than one properties file and
>retrieve it from the properties file by specifying some identifier.
>
>   For e.g., <bean:message key="xx.xx" file="xx"/>.
>
>Regards,
>Thiru
>
>  
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>



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