When a post method is submitted, a JSP page shows the result in fields in the next page. How can I red mark those fields who gets null value in the 2nd page?

有帮助吗?

解决方案

Within the forEach loop you can write,

<c:choose>
    <c:when test='${iterator.name eq ''}'>
        <td style='background-color:red;'> <c:outvalue="${iterator.name}"/> </td>
    </c:when>
    <c:otherwise>
        <td> <c:outvalue="${iterator.name}"/> </td>
    </c:otherwise>
</c:choose>

As you can see when the value will be null you can set the background color of that cell to red and when it returns some value you can display it the way you were doing it before.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top