On Thu, 2 Jan 2003, ROSSEL Olivier wrote:

> Date: Thu, 02 Jan 2003 17:47:46 +0100
> From: ROSSEL Olivier <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> Subject: Multiple message-properties
>
> I wish to have my message resources in several files:
>    <message-resources parameter="java.resources.application" />
>    <message-resources parameter="language" />
>    <message-resources parameter="database" />
>
> When I launch Tomcat, I have realized that the LAST message-resources
> is read, but not the others.
> Is it a feature?
>
> There is another way to declare several mesage-resources?
>

To use multiple message-resources declarations in a single Struts webapp,
you need to declare the servlet context attribute under which the extra
ones (other than the default) are stored, using the "key" attributes.
Perhaps something like:

  <message-resources parameter="java.resources.application"/>
  <message-resources parameter="language" key="lang"/>
  <message-resources parameter="database" key="data"/>

Note that you'll need to explicitly reference the different message
resources bundles when you select particular messages -- for example, to
grab a message from the database resources in a JSP page, you'd need to
say:

  <bean:message key="sql.error" bundle="data"/>

It would be technically feasible to write a MessageResources
implementation that combined multiple sources files into a single
"application resources" bundle, but this is not supported by the standard
implementation.

Craig


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

Reply via email to