Bug 7646

Summary: One <fmt:param> tag must be supplied ...
Product: Taglibs Reporter: David Geary <sabreware>
Component: Standard TaglibAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: Other   
OS: other   

Description David Geary 2002-03-31 20:38:04 UTC
I have this code:

<fmt:message key='message.diskFull'>
   <fmt:param value='${5}'/>
</fmt:message>

For this properties file:

message.diskFull=Disk number <b>{0}</b> filled up at <b>{1, time}</b> on <b>
{1, date}</b>.

I get output like this:

Disk number 5 filled up at {1} on {1}.

But, the spec states:

One <fmt:param> action must be specified for each variable in the compound 
message or message pattern.

Because of that wording in the spec, I expected an error.

Ok, now go ahead and tell me why this one's not a bug. ;-)
Comment 1 Jan Luehe 2002-04-02 01:15:22 UTC
I agree this statement in section 8.8 (<fmt:param>):

  One <fmt:param> action must be specified for each variable in the compound 
  message or message pattern.

is misleading and should be removed.

Maybe we can reword the 2nd paragraph as follows:

  Parametric replacement takes place in the order of the <fmt:param>
  tags.  The compound message given by the parent <fmt:message> action
  is used as the argument to the applyPattern() method of a
  java.text.MessageFormat instance, and the values of the <fmt:param> tags
  are collected in an Object[] and supplied to that instance's format()
  method.