Bug 46915 - Unable to get ResourceBundle keys in Tomcat 6
Summary: Unable to get ResourceBundle keys in Tomcat 6
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Servlet & JSP API (show other bugs)
Version: 6.0.18
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2009-03-26 03:27 UTC by Kapil
Modified: 2012-03-30 22:35 UTC (History)
1 user (show)

modified foreach.jsp file that reads properties file (1.93 KB, text/plain)
2009-03-26 03:27 UTC, Kapil

Note You need to log in before you can comment on or make changes to this bug.
Description Kapil 2009-03-26 03:27:15 UTC
Created attachment 23417 [details]
modified foreach.jsp file that reads properties file

There is issue with ResourceBundle using JSTL in tomcat 6. The problem is in using the following code


The above code is not able to resolve the keys and result in printing of ???keys???

Here messageString is a variable set using below code
<fmt:setBundle basename="LocalStrings" scope="session" var="messageString" />

I have tested it with example jsp provided in the tomcat's example webapp.

The issue is reproducible with both JSTL1.1 and JSTL 1.2 and JDK 1.5 and 1.6

However it is working fine in Tomcat 5.5

Attached is the sample foreach.jsp with modified code to read a property file available in \webapps\examples\WEB-INF\classes folder under tomcat installation directory. 
Just place this file in examples webapp and view source
Comment 1 Mark Thomas 2009-03-26 10:02:29 UTC
This has been fixed in trunk and proposed for 6.0.x
Comment 2 Mark Thomas 2009-04-28 04:16:24 UTC
This has been fixed in 6.0.x and will be in 6.0.20 onwards.
Comment 3 Mark Thomas 2012-03-30 16:37:20 UTC
This bug should have been resolved as INVALID since the behaviour complained about is required by the EL specification.

There is no way to avoid this in Tomcat 6 but in Tomcat 7 onwards
${messageString.resourceBundle.getKeys()} can be used.

The regression was reported as bug 53001.
Comment 4 Konstantin Kolinko 2012-03-30 22:35:21 UTC
Confirming as INVALID.

To find the place in specification, search for the string of "???". -> it is in description of ResourceBundleELResolver.getValue(..) method.

5.5.x might be different, because javax.el package and ResourceBundleELResolver were introduced with JSP 2.1.

Just noting that JSTL has similar feature in its i18n tags - see fmt:message.