On 10/17/2003 02:17 PM Kris Schneider wrote:
One approach you could take would be to create your set of alternate
LocalizationContext instances at application startup and store them in
application scope:

ResourceBundle countriesBundle =  ResourceBundle.getBundle("countries", locale);
LocalizationContext countriesCtx = new LocalizationContext(countriesBundle, locale);
servletCtx.setAttribute("countriesCtx", countriesCtx);

ResourceBundle statesBundle =  ResourceBundle.getBundle("states", locale);
LocalizationContext statesCtx = new LocalizationContext(statesBundle, locale);
servletCtx.setAttribute("statesCtx", statesCtx);

Then, in your JSP:

<fmt:message bundle="${applicationScope.countriesCtx}" key="message.test">
<fmt:message bundle="${applicationScope.statesCtx}" key="message.test">

in web.xml this will set up one as the default so you only need to programmatically set up the others, so at least for the most-used bundle you won't have to specify the 'bundle' attribute:


  <context-param>
    <param-name>
      javax.servlet.jsp.jstl.fmt.localizationContext
    </param-name>
    <param-value>ApplicationResources</param-value>
  </context-param>



--
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9


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



Reply via email to