[jboss-user] [JBoss Portal] - Re: HOW to change Locale in Program?
qqqqzaza
do-not-reply at jboss.com
Wed Mar 21 23:36:12 EDT 2007
i have changed LocaleInterceptor.java..
there is another struts ChangeLocale program which will set locale to session
but it seems not work....help..
public class LocaleInterceptor extends ServerInterceptor
{
/** The logger. */
protected Logger log = Logger.getLogger(getClass());
protected void invoke(ServerInvocation invocation) throws Exception, InvocationException
{
ServerRequest req = invocation.getRequest();
// Locale locale = req.getContext().getClientRequest().getLocale();
HttpSession session = req.getContext().getClientRequest().getSession();
Locale locale = (Locale) session.getAttribute"org.apache.struts.action.LOCALE");
log.debug("LocaleInterceptor Locale: "+locale);
if (locale == null){
locale = req.getContext().getClientRequest().getLocale();
log.debug("2. LocaleInterceptor Locale: "+locale);
session.setAttribute("org.apache.struts.action.LOCALE", locale);
}
try
{
req.setLocales(new Locale[]{locale});
invocation.invokeNext();
}
finally
{
req.setLocales(null);
}
}
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4030465#4030465
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4030465
More information about the jboss-user
mailing list