Should the absence of a locale setting cause fmt:formatNumber to
ignore the maxFractionDigits attribute?

Test case:
--------------------------------------------------------------------
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"; prefix="fmt" %>

<c:set var="someCount" value="61"/>
<c:set var="counter1">
<fmt:formatNumber type="number"
        maxFractionDigits="0" value="${ someCount / 3 }"/></c:set>

${counter1}
|
<fmt:setLocale value="en_US"/>
<c:set var="counter2">
<fmt:formatNumber type="number"
        maxFractionDigits="0" value="${ someCount / 3 }"/></c:set>

${count}
--------------------------------------------------------------------

Most browsers will show
 20 | 20

but user-agents not providing a Locale via an Accept-Language header
like wget (and Amaya) retrieve

 20.333333333333332 | 20

If I manually add a header to wget, e.g.
   wget --header='Accept-Language: en-us,en'
then the result is '20 | 20'

Is this proper behavior or a bug?  I realize it's probably a little
suspect using formatNumber to do quick'n'dirty "rounding", but it's
for presentational purposes, so... :-)

TIA!

/* Test env: Tomcat 5.5.9 / (Sun) JDK 1.5.0_03 / JSTL 1.1.2 */
--
Hassan Schroeder ----------------------------- [EMAIL PROTECTED]
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                          dream.  code.



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

Reply via email to