Kris Schneider wrote:
Strange, because the following seems to work:
web.xml: -------- <web-app> .... <context-param> <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name> <param-value>Messages</param-value> </context-param> .... </web-app>
WEB-INF/classes/Messages.properties: ------------------------------------ msg=Messages
WEB-INF/classes/Messages_ru.properties: --------------------------------------- msg=Messages_ru
fmtlocale.jsp: -------------- <%@ page contentType="text/plain" %> <%@ page import="java.util.Locale" %> <%@ page import="javax.servlet.jsp.jstl.core.Config" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<% Config.set(session, Config.FMT_LOCALE, new Locale("ru")); %>
msg: <fmt:message key="msg"/>
output: ------- msg: Messages_ru
Is that basically the equivalent of what you're doing?
Quoting Bill Siggelkow <[EMAIL PROTECTED]>:
I have created a Struts action similar to one suggested by Kris Schneider to change the current locale for both Struts and JSTL.
In the action after creating a locale based on user input I make the following two calls:
// reset the Struts locale session.setAttribute(Globals.LOCALE_KEY, locale);
// reset the JSTL locale Config.set(session, Config.FMT_LOCALE, locale);
I then redirect to the page where I display some text based on the locale.
The Struts bean:message works perfectly - however, the JSTL fmt:message does not work -- by the way, I do have the LocalizationContext pointing to my ApplicationResources through the web.xml context-param.
Interestingly enough, if I do use <fmt:setLocale locale="ru"/> on the before the <fmt:message key="foo"/> it works!
Does anyone have any ideas on why the Config.set(...) is not working?
Bill Siggelkow
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]