Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top