0

I am new to this so be gentle. I am working on a JSP page and would like implement an if statement.

command.total is set previously and I can't change its type.

<c:set var="number1" value="${5}"/>
<c:set var="number2" value="${0}"/>
<c:set var="number3" value="${command.total}"/>
<c:out value="${number1}" />
<c:out value="${command.total}" />

<c:choose>
<c:when test="${number1 < number2}">
${"number1 is less than number2"}
</c:when>
<c:when test="${number1 > number3}">
${"aaaaaaaaaaaaaaaaaaaa"}
</c:when>
<c:otherwise>
${"cccccccccccccccccccccccccccccccccc"}
</c:otherwise>
</c:choose>

This always fails and I believe that the problem is that command.total is returned as a string.

I have tried to convert the string with the following:

<fmt:parseNumber value="command.total" var="test" integerOnly="TRUE" type="NUMBER"></fmt:parseNumber>
    <c:out value="${test}"></c:out>

Is it possible to convert this string to a number?

user812786
  • 4,302
  • 5
  • 38
  • 50
TJ15
  • 353
  • 2
  • 10
  • 22

0 Answers0