I am having a strange problem with JSTL locale's after Session.invalidate.
I am using JSTL as the main TagLib with Struts 1.2.9. So to keep both
systems in sync, I have a servlet filter that executes this code:
protected void doFilter (HttpServletRequest req,HttpServletResponse
res,FilterChain chain) throws IOException, ServletException {
Locale locale;
HttpSession ses = req.getSession();
String locstr = req.getParameter("locale");
if(locstr == null) {
if((locale = (Locale)ses.getAttribute(Globals.LOCALE_KEY)) == null) {
locale = req.getLocale();
}
} else {
locale = new Locale(locstr);
}
if(locale != null) {
ses.setAttribute(Globals.LOCALE_KEY,locale);
Config.set(ses,Config.FMT_LOCALE,locale);
}
chain.doFilter(req,res);
} //doFilter
This works great except when, after the LogoutAction calls
Session.invalidate(), I redirect to a "Logout Success" page. For some
reason that page picks up the French text from the application_fr.properties
resource file for the JSTL tags, but not for the Struts tags.
I have put lots of debugging in the stream and from what I can see, the
Locale is getting set in the filter, but by the time the JSP page is
processed, Config.FMT_LOCALE is null.
Any insights would be greatly appreciated.
(*Chris*)