JSTL c:if test string not null gotcha
March 14, 2012 14:23:14 Last update: March 14, 2012 14:23:14
If
You have to use "not empty":
forgotPasswordForm.error is a String and not null, you cannot test the error condition with:
<!-- This does not work! --> <c:if test="${forgotPasswordForm.error}"> <p class="error">${forgotPasswordForm.error}</p> </c:if>
You have to use "not empty":
<c:if test="${not empty forgotPasswordForm.error}"> <p class="error">${forgotPasswordForm.error}</p> </c:if>