Bug 14590 - fmt:message + fmt:param tag chokes when the value contains single quotes
Summary: fmt:message + fmt:param tag chokes when the value contains single quotes
Status: RESOLVED INVALID
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Standard Taglib (show other bugs)
Version: 1.0
Hardware: All All
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-15 13:44 UTC by peter lin
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description peter lin 2002-11-15 13:44:19 UTC
A coworker discovered a bug with <fmt:message> that use <fmt:param> parameters. 
Here is a description of how to produce the bug.

make a properties file named test.properties in
WEB-INF/classes/test/test.properties.

param.key=text before ftm' param {0} text after ftp param

In the JSP, use fmt tag to get the corresponding values out.

<fmt:setBundle basename="test.test" var="test" scope="request"/>

<fmt:message key="param.key" bundle="${test}">
  <fmt:param><c:out value="speedy gonzales"/></fmt:param>
</fmt:message>

what ends up happening is the "'" causes it to not display correctly. 
If you change "fmt'" to just "fmt", the message will display correctly. Also, if 
you use two single quotes instead of one, the message will display correctly. 
When <fmt:message> is used without <fmt:param>, single quotes do not cause a bug 
and display correctly.

peter lin
Comment 1 Pierre Delisle 2002-11-22 22:34:47 UTC
This is not a bug in JSTL, but a peculiarity of how a single
quote is interpreted by java.text.MessageFormat.

For more details, you may want to check bug
reports 4293229 and 4321513 in the java bug database
(http://developer.java.sun.com/developer/bugParade).

The simple rule is as follows:
If there is a {0} placeholder in a message string, 
single quotes have to be doubled.

    -- Pierre