DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13523>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13523

problem using JSTL fmt:setLocale with Tomcat 4.1.9

           Summary: problem using JSTL fmt:setLocale with Tomcat 4.1.9
           Product: Tomcat 4
           Version: 4.1.9
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Catalina
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


To demonstrate the problem first create two resource bundle properties files
as follows:
--
labels_en.properties:
  hello=hello
  goodbye=goodbye
--
labels_es.properties:
  hello=hola
  goodbye=adios
--
put them in a jar and place the jar in the WEB-INF/lib dir of a webapp

now place the following code into a .jsp file and put it in the main dir of
the same webapp where you put the resource bundle jar
--
<%-- possible tomcat bug when using JSTL fmt:setLocale
--%>
<%@ taglib prefix="c"   uri="http://java.sun.com/jstl/core"; %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt"; %>
<html>
<body>

<c:if test="${param.locale != null}">
 <fmt:setLocale value="${param.locale}" scope="session" />
</c:if>

<a href="?locale=en">English</a> -
<a href="?locale=es">Spanish</a> -
<br /><br />
<jsp:useBean id="now" class="java.util.Date" />
The date functions seem to work correctly with regard to locale.<br />
Date: <fmt:formatDate value="${now}" dateStyle="full" /><br />
Time: <fmt:formatDate value="${now}" type="time" /><br />
<br />
<%-- create a jar with the resource bundles .class and/or .properties files
     that contain the key=value pairs:
        e.g.: labels_en.properties, labels_es.properties
     and place it in the WEB-INF/lib dir of your webapp 
--%>
<fmt:setBundle basename="labels" var="labelsBundle" scope="session"/>
<fmt:bundle basename="labels">
The bundle functions do not seem to work correctly with regard to locale<br />
unless we specifically do a &lt;fmt:setLocale 
value="hard_coded_string" /&gt;.<br />
It seems as though the fmt:setLocale is interpreted at compile time not 
runtime.<br />
Hello: <fmt:message key="hello" /><br />
Goodbye: <fmt:message key="goodbye" />
</fmt:bundle>

</body>
</html>
--
bring up browser and access the .jsp file
http://localhost:8080/thewebapp/thefile.jsp

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to