Bug 20778

Summary: Locale can only be set once JSTL <fmt:setLocale>
Product: Taglibs Reporter: Jesse Hallio <apache-bugzilla>
Component: Standard TaglibAssignee: Tomcat Developers Mailing List <dev>
Severity: normal CC: t5jtjj502
Priority: P3    
Version: 1.0   
Target Milestone: ---   
Hardware: Macintosh   
OS: All   
Attachments: War file to test under tomcat 4.1.27 running under J2SE 1.4.2

Description Jesse Hallio 2003-06-14 17:21:40 UTC
(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.


<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>

  <title>JSTL: Formatting/I18N Support -- German Locale Example</title>
<body bgcolor="#FFFFFF">
<h3>German Locale</h3>

<fmt:setLocale value="${param.tl}"/>
<fmt:bundle basename="org.apache.taglibs.standard.examples.i18n.Resources">

Comment 1 Pierre Delisle 2003-06-20 00:02:17 UTC
Please give it a try with JSTL 1.0.3 (or the standard-1.0 nightly). 
It works for me.
Comment 2 Jesse Hallio 2003-06-26 19:44:07 UTC
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 

 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 

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)
Comment 3 Pierre Delisle 2003-09-10 17:23:24 UTC
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:


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)
Comment 4 Pierre Delisle 2003-09-10 17:25:07 UTC
Created attachment 8131 [details]
War file to test under tomcat 4.1.27 running under J2SE 1.4.2
Comment 5 Jesse Hallio 2003-09-10 20:06:30 UTC
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.