title: Comparing BigDecimal to 0 in JSTL
body: <p>Excuse the basic question, I'm crash-coursing myself on Java/JSTL to fix an issue for a client and have not been able to quickly find the answer to something I'm dealing with....</p>
  
  <p>I have a JSP page which uses the <code>&lt;c:if&gt;</code> tag to compare a variable to the constant value of <code>0</code>. This is always returning <code>False</code> for me. I.e.</p>
  
  <pre><code>&lt;c:set var="total" value="0" /&gt;
  &lt;c:forEach items="${parentItem.children}" var="child"&gt;
      &lt;c:set var="total" value="${total+child.revenue}" /&gt;
      &lt;c:if test="${total == 0}"&gt;
          It is zero.
      &lt;/c:if&gt;
  &lt;/c:forEach&gt;
  </code></pre>
  
  <p>From my understanding, I have to explicitly compare like-types, however when attempting to do something like this, I get an error:</p>
  
  <pre><code>&lt;c:if test="${total.compareTo(BigDecimal.ZERO) == 0}"&gt;
      -
  &lt;/c:if&gt;
  </code></pre>
  
  <p>The error is: <code>The function compareTo must be used with a prefix when a default namespace is not specified</code>.</p>
  
  <p>I'm using JSTL 1.2.</p>