(tried only on OSX 10.2.6 with tomcat 4.1.24 and jdk 1.4.1) Setting the locale with <fmt:setLocale> works only once in application. Below is a modified version of standard-examples/format/GermanLocale.jsp to reproduce the problem. The first loading of the page sets the locale, and it cannot be changed anymore (regardless of browser and machine used to loca the page). The both urls below will output the german version of greeting. http://localhost:8080/standard-examples/format/testlocale.jsp?tl=de http://localhost:8080/standard-examples/format/testlocale.jsp?tl=it_IT testlocale.jsp: --- <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %> <html> <head> <title>JSTL: Formatting/I18N Support -- German Locale Example</title> </head> <body bgcolor="#FFFFFF"> <h3>German Locale</h3> <fmt:setLocale value="${param.tl}"/> <fmt:bundle basename="org.apache.taglibs.standard.examples.i18n.Resources"> <fmt:message> greetingMorning </fmt:message> </fmt:bundle> </body> </html> ---
Please give it a try with JSTL 1.0.3 (or the standard-1.0 nightly). It works for me.
I did some more testing with the 1.0 and servlets, too, and the bug is definitely there - the first user that loads a JSP page will set the locale for every download after the first one - all users will get the first user's locale with no way to change it, not even through javax.servlet.jsp.jstl.core.Config. I could not verify it with nightly. I tried several but none of them would even install the webapp to tomcat. I tried to use the nightly instead of the 1.0 (my ant-script copies the c.tld, fmt.tld, jstl.jar, and standard.jar to proper places). I just get many exceptions, with the first two below (jEdit won't let me cut'n'paste from the tomcat output window, apparently, so here is manually written head of the exception, typos are all mine.) These are speficially from jakarta-taglibs-standard-20030626. --- Jun 26, 2003 10:13:15 PM org.apache.commons.digester.Digester error SEVERE: Parse Error at line 6 column 19: Document root element "taglib" must match DOCTYPE root "null". org.xml.sax.SAXParseException: Document root element "taglib", must match DOCTYPE root "null". at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) ... Jun 26, 2003 10:13:15 PM org.apache.commons.digester.Digester error SEVERE: Parse Error at line 6 column 19: Document is invalid: no grammar found. org.xml.sax.SAXParseException: Document is invalid: no grammar found. at org.apache.xerces.util.ErrorhandlerWrapper.createSAXParseException(Unknown Source) ... ---
As I mentioned previously, it all works fine for me. I am therefore attaching a war file to help us understand why it does not for you. So, please use the following configuration: - tomcat 4.1.27 running under J2SE 1.4.2 Drop the attached war file (i18ntest.war) in the webapps directory of tomcat 4.1.27, start tomcat, and access the following URL: http://localhost:8080/i18ntest/test.jsp Select the various locales, and see if the message is displayed in the proper locale. I'd appreciate if you could tell us whether it works or not as soon as possible so we can take care of this bug report. (by the way the standard taglib used in this war file is the nightly build of standard-1.0 of 20030910)
Created attachment 8131 [details] War file to test under tomcat 4.1.27 running under J2SE 1.4.2
Pierre Delisle's package works: tested with Mac OS X 10.2.6 with java 1.4.1 Update 1, with Tomcat 4.1.24 and 4.1.27. I also tested with the previously non-working JSP and it did still not work. With the jars from Pierre Delisle's package it worked, so the bug must have been fixed in the later builds. The standard taglib nightly build of standard-1.0 of 20030910 is verified to work correctly in the configuration mentioned above.