Bug 21836 - JSTL: Compiler errors from formatNumber tag
Summary: JSTL: Compiler errors from formatNumber tag
Status: RESOLVED INVALID
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Standard Taglib (show other bugs)
Version: 1.0
Hardware: Macintosh All
: P3 major (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-23 21:07 UTC by Ron Newman
Modified: 2005-03-20 17:06 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ron Newman 2003-07-23 21:07:06 UTC
I'm trying to use the JSTL <fmt:formatNumber> tag with request-time expressions (NOT the JSTL 
expression language) and not having much luck.

Here's my JSP:

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

<% 
  byte b = 92;
  short s = 1025;
  int i = 172343;
  long l = 4782472384782L;
  float f = 3.14159f;
  double d = 2.718281828e55;
%>

<html>
<head><title>JSTL Test</title></head>

<body>

<p>b <f:formatNumber pattern="#,##0" value="<%= b %>"/></p>
<p>s <f:formatNumber pattern="#,##0" value="<%= s %>"/></p>
<p>i <f:formatNumber pattern="#,##0" value="<%= i %>"/></p>
<p>l <f:formatNumber pattern="#,##0" value="<%= l %>"/></p>
<p>f <f:formatNumber pattern="#,##0.00e00" value="<%= f %>"/></p>
<p>d <f:formatNumber pattern="#,##0.00e00" value="<%= d %>"/></p>

</body>
</html>

and here are the error messages I get from Jasper.  (I've removed most of the file paths for 
readability.)

    [javac] .../jstl-test/bug_jsp.java:72: cannot resolve symbol
    [javac] symbol  : method setValue (byte)
    [javac] location: class org.apache.taglibs.standard.tag.rt.fmt.FormatNumberTag
    [javac]       _jspx_th_f_formatNumber_0.setValue( b );

    [javac] .../jstl-test/bug_jsp.java:84: cannot resolve symbol
    [javac] symbol  : method setValue (short)
    [javac] location: class org.apache.taglibs.standard.tag.rt.fmt.FormatNumberTag
    [javac]       _jspx_th_f_formatNumber_1.setValue( s );

    [javac] .../jstl-test/bug_jsp.java:96: cannot resolve symbol
    [javac] symbol  : method setValue (int)
    [javac] location: class org.apache.taglibs.standard.tag.rt.fmt.FormatNumberTag
    [javac]       _jspx_th_f_formatNumber_2.setValue( i );

    [javac] .../jstl-test/bug_jsp.java:108: cannot resolve symbol
    [javac] symbol  : method setValue (long)
    [javac] location: class org.apache.taglibs.standard.tag.rt.fmt.FormatNumberTag
    [javac]       _jspx_th_f_formatNumber_3.setValue( l );

    [javac] .../jstl-test/bug_jsp.java:120: cannot resolve symbol
    [javac] symbol  : method setValue (float)
    [javac] location: class org.apache.taglibs.standard.tag.rt.fmt.FormatNumberTag
    [javac]       _jspx_th_f_formatNumber_4.setValue( f );

    [javac] .../jstl-test/bug_jsp.java:132: cannot resolve symbol
    [javac] symbol  : method setValue (double)
    [javac] location: class org.apache.taglibs.standard.tag.rt.fmt.FormatNumberTag
    [javac]       _jspx_th_f_formatNumber_5.setValue( d );
Comment 1 Pierre Delisle 2003-08-02 01:43:20 UTC
As per the spec, section 9.7, the value attribute of <fmt:formatNumber>
accepts values of type String or Number. It does not accept
primitive types such as short, int, etc...

[Automatic type conversions are supported with the EL version of the
library.]