You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Garner Shawn <sh...@gmail.com> on 2006/09/28 22:56:08 UTC

[help] struts 1.2.9 exposing struts resource bundle to jstl

I want to be able to refer to the struts resource bundle using the
fmt:message tag.
I've been looking at the reference and I'm not sure the JSTL
LocalizationContext is interchangeable with a MessageResources.

Is there an easy way to do this?

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


Re: [help] struts 1.2.9 exposing struts resource bundle to jstl

Posted by Don Brown <do...@gmail.com>.
The easiest way is to just load the bundle via JSTL in the page.  The
messages properties file will be in the same format as recognized by
JSTL.  The disadvantage of this approach is you are loading the
messages twice (once for Struts, once for JSTL) and doesn't work if
your messages are from another source like a database.

Don

On 9/28/06, Garner Shawn <sh...@gmail.com> wrote:
> I want to be able to refer to the struts resource bundle using the
> fmt:message tag.
> I've been looking at the reference and I'm not sure the JSTL
> LocalizationContext is interchangeable with a MessageResources.
>
> Is there an easy way to do this?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: [help] struts 1.2.9 exposing struts resource bundle to jstl

Posted by Wendy Smoak <ws...@gmail.com>.
On 9/28/06, Garner Shawn <sh...@gmail.com> wrote:

> I want to be able to refer to the struts resource bundle using the
> fmt:message tag.
> I've been looking at the reference and I'm not sure the JSTL
> LocalizationContext is interchangeable with a MessageResources.
>
> Is there an easy way to do this?

In web.xml, I have:

 <!-- this is necessary for the JSTL <fmt:message> tags to work -->
   <context-param>
      <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
      <param-value>ApplicationResources</param-value>
   </context-param>

And in struts-config, the same message bundle:

<!-- ========== Message Resources Definitions ============ -->
  <!-- This is the location of the ApplicationResources.properties file -->
  <message-resources parameter="ApplicationResources" null="false" />

-- 
Wendy

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