当JSP中没有值时,如何将字段显示为空?

时间:2017-02-14 15:24:24

标签: jsp struts2 jstl

我正在尝试解决一个错误,CashFlow + CashOutFlow =净现金流量

直到第3排才正确。但是,当它应该为空时,不确定为什么剩下的行用(.007)的值填充。

enter image description here

<c:forEach items="${cashCalculations}" var="f">  
<!-- Row: Revised Forecast Inflow -->
                    <c:choose>
                        <c:when test="${not empty histAvgCashInflow && histAvgCashInflow != 0 || not empty f.userInflow && f.userInflow != 0}">
                            <c:set var="revisedFcstCashInflow" value="${histAvgCashInflow + f.userInflow}"/>
                            <td align="right" class="${revisedFcstCashInflow < 0 ? 'fontRed' : ''}">
                            <fmt:formatNumber type="currency"  pattern="#,###.0;(#,###.0)" maxFractionDigits="3" value="${revisedFcstCashInflow}" /></td>
                        </c:when>
                        <c:otherwise>
                            <td></td>
                        </c:otherwise>
                    </c:choose>

                    <!-- Row: Revised Forecast Outflow -->
                    <c:choose>
                        <c:when test="${not empty histAvgCashOutflow && histAvgCashOutflow !=0 || not empty f.userOutflow && f.userOutflow != 0 }">                         
                        <c:set var="revisedFcstCashOutflow" value="${histAvgCashOutflow + f.userOutflow}"/>
                            <td align="right" class="${revisedFcstCashOutflow < 0 ? 'fontRed' : ''}">
                            <fmt:formatNumber type="currency"  pattern="#,###.0;(#,###.0)" maxFractionDigits="3" value="${revisedFcstCashOutflow}" /></td>
                        </c:when>
                        <c:otherwise>
                            <td></td>
                        </c:otherwise>
                    </c:choose>

                    <!-- Row: Revised Forecast NetCash Flow -->
                    <c:choose>
                        <c:when test="${not empty revisedFcstCashInflow && revisedFcstCashInflow != 0 || not empty revisedFcstCashOutflow && revisedFcstCashOutflow != 0}">

                            <c:set var="revisedFcstNetFlow" value="${revisedFcstCashInflow + revisedFcstCashOutflow}"/>
                            <c:choose>

                            <c:when test="${not empty revisedFcstNetFlow && revisedFcstNetFlow != 0}">
                                <td align="right" class="${revisedFcstNetFlow < 0 ? 'fontRed' : ''}">
                                <fmt:formatNumber type="currency"  pattern="#,###.0;(#,###.0)" maxFractionDigits="3" value="${revisedFcstNetFlow}" /></td>
                            </c:when>    
                            <c:otherwise>
                                <td></td>
                            </c:otherwise>                                  
                            </c:choose>
                        </c:when>
                        <c:otherwise>
                            <td></td>
                        </c:otherwise>
                    </c:choose>
   </c:forEach>

0 个答案:

没有答案