If the value in JSTL is 0, can we not print it out?

Asked 2 years ago, Updated 2 years ago, 143 views

        <td align='center'>
        <c:out value='${resultList.out_qty}' /><c:out value='${resultList.in_qty}' />
        </td>

To display quantities in the statement output file, take out_qty, in_qty, and mark quantities. Some of them are in, some of them are out, so if there are 10 out, then there should be no value in out, but if there's a value of 0 in, it's not 10, it's If it's 0, is there any other way to stop printing?

java jsp jstl

2022-09-21 11:56

1 Answers

There is a <c:if> link in the comments, so solve it with that, or
Or does EL support the triad operator:

${resultList.in_qty ne 0 ? resultList.in_qty : ""}

Here's how it works.

And <c:out> is meaningless if XML escape is not the purpose.


2022-09-21 11:56

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.