---El expression retains two decimal places, retains two decimal places using JSTL <fmt:formatNumber> tags
<%@ taglib uri= "http://java.sun.com/jsp/jstl/fmt" prefix= "FMT"%>
<fmt:formatnumber type= "number" value= "${688.87 * 0.8}" pattern= "0.00" maxfractiondigits= "2"/>
< TD >< type= "number" value= "${item.lakecoin}" pattern= "0.00" /></td>
<fmt:formatnumber type= "number" value= "${LB.MONBZFJ}" maxfractiondigits= "2"/> What does maxfractiondigits= "2" mean here?
Max fraction decimal digits number of digits
Maximum number of decimal digits = 2
---JSP page shows red when a variable is negative
<TDNoWrap class= "TDJJ"Align= "Center"> <c:ifTest= "${list.profitmoney < ' 0 '}"> <FontColor= "Red">${list.profitmoney}</Font> </c:if> <c:ifTest= "${list.profitmoney >= ' 0 '}"> <FontColor= "BLACK">${list.profitmoney}</Font> </c:if></TD>
${list.profitmoney} is the value of a variable that is queried by a JSP page.
The above code is to implement if negative, the font color is marked red. If positive or 0, the font color is black.
<TDMethods of >//if <c:ifTest= "${item.anxcoin<0}"> <FontColor= "Red"><Fmt:formatnumbertype= "Number"value= "${item.anxcoin}"pattern= "0.00" /></Font> </c:if> <c:ifTest= "${item.anxcoin>=0}"> <Fmt:formatnumbertype= "Number"value= "${item.anxcoin}"pattern= "0.00" /> </c:if></TD>
Method of Choose when otherwise
<TD><C:choose> <C:whenTest= "${item.anxcoin<0}"> <FontColor= "Red"><Fmt:formatnumbertype= "Number"value= "${item.anxcoin}"pattern= "0.00" /></Font> </C:when> <c:otherwise><Fmt:formatnumbertype= "Number"value= "${item.anxcoin}"pattern= "0.00" /></c:otherwise></C:choose></TD>
Jsp-el-expression