Got around it by using the actual locale:

  <%@ page import="org.apache.struts.action.Action" %>

  <bean:define id="locale" name="<%=Action.LOCALE_KEY%>"
type="java.util.Locale"/>

  <a href="<%="refstart" + locale.toString() + "/refend.html"%>">Click here
  </a>

I still haven't answered my original question, but it's now moot.

> -----Original Message-----
> From: Jim Tomlinson 
> Sent: Monday, January 07, 2002 3:39 PM
> To: '[EMAIL PROTECTED]'
> Subject: Access to localized messages to build an href
> 
> 
> I'm trying to get access to the MessageResources object that, 
> according to
> the docs, is an application scope bean. I need to build an 
> href in this
> manner:
> 
>   <a href="<%="refstart" + <bean:message key="footer_locale"/> +
> "/refend.html"%>">Click here
>   </a>
> 
> Of course, this doesn't work (with single quotes, either, as 
> suggested for a
> similar problem on this list). I've worked around it like this:
> 
>   <% MessageResources resources =
>              
> MessageResources.getMessageResources("com.foo.bar.Resources");
>      String locale = resources.getMessage("footer_locale");
>   %>
>   <a href="<%="refstart" + locale + "/refend.html"%>">Click here
>   </a>
> 
> but I'd like to avoid the scriptlet. What name is the MessageResources
> object registered as in the application scope, so I can use 
> bean:define to
> get at it? Or is there another way to accomplish this without 
> using the
> scriptlet (no, I don't want to put the entire href in the 
> resource file).
> Thanks.
> -- 
> Jim Tomlinson
> [EMAIL PROTECTED]
> 

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

Reply via email to