大家好我试图做一系列检查以连接两个我要减去和格式化的数字。这可能还是有替代方案?我在标题中得到了这个错误。感谢
<td><fmt:formatNumber value='${'
<c:choose>
<c:when test="${columnB == 'MWS'}">'line.initialQS.quantities[0]'</c:when>
<c:when test="${columnB == 'SMC Unfunded'}">'line.expectedUnfundedQS.quantities[0]'</c:when>
<c:when test="${columnB == 'SMC Funded'}">'line.expectedFundedQS.quantities[0]'</c:when>
<c:when test="${columnB == 'MMC'}">'line.targetQS.quantities[0]'</c:when>
<c:when test="${columnB == 'Current Scenario'}">'line.currentQS.quantities[0]'</c:when>
<c:otherwise>
</c:otherwise>
</c:choose>
' - '
<c:choose>
<c:when test="${columnA == 'MWS'}">'line.initialQS.quantities[0]'</c:when>
<c:when test="${columnA == 'SMC Unfunded'}">'line.expectedUnfundedQS.quantities[0]'</c:when>
<c:when test="${columnA == 'SMC Funded'}">'line.expectedFundedQS.quantities[0]'</c:when>
<c:when test="${columnA == 'MMC'}">'line.targetQS.quantities[0]'</c:when>
<c:when test="${columnA == 'Current Scenario'}">'line.currentQS.quantities[0]'</c:when>
<c:otherwise>
</c:otherwise>
</c:choose>
'}'
type="number" maxIntegerDigits='10' minFractionDigits='0' maxFractionDigits='2' groupingUsed='true' /></td>
答案 0 :(得分:2)
定义值的变量:
...
<c:when test="${columnB == 'MWS'}">
<c:set var="bValue" value="${line.initialQS.quantities[0]}" />
</c:when>
...
然后进行计算或格式化:
<fmt:formatNumber value="${bValue - aValue}" type="number" maxIntegerDigits="10" minFractionDigits="0" maxFractionDigits="2" groupingUsed="true" />