Bug 10134

Summary: EL coercion not handling BigDecimal properly
Product: Taglibs Reporter: Serge Knystautas <sergek>
Component: Standard TaglibAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED REMIND    
Severity: major CC: jsr-152-eg
Priority: P3    
Version: 1.0   
Target Milestone: ---   
Hardware: Other   
OS: other   

Description Serge Knystautas 2002-06-21 19:14:28 UTC
I'm using the sql tag to pull some numbers out of the database, and our db
driver is returning BigDecimal objects.  I then try to use EL to do arithmetic
operations on these BigDecimal objects, but it rounds everything.  I dug into
Coercion and PrimitiveObject, and if the Number isn't one of a standard couple,
it casts it to an Integer (and thus loses my rounding).

Here's a sample JSP to see the behavior:
<%@ page import="java.math.*" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%
pageContext.setAttribute("a", new BigDecimal(1.5));
pageContext.setAttribute("b", new BigDecimal(2.25));
%>
a + b = <c:out value="${a + b}" />
<br />
a - b = <c:out value="${a - b}" />
Comment 1 Justyna Horwat 2002-06-27 23:44:44 UTC
The JSTL 1.0 EL will be deprecated by the JSP 2.0 EL (JSR 152). This bug should 
be addressed by the JSR 152 expert group. I'm forwarding to the JSR 152 EG.