How to test the if condition in JSP?

时间:2017-06-15 09:33:13

标签: html jsp

I want to only display the error message in JSP. This means if the error variable is present then its message will be displayed and the form will be hidden.

<c:choose>
    <c:when test="${errorMessage ne null}">
           error; ${errorMessage}  //I have the error
         </c:when>

         <c:otherwise>
<form action="send-mail" method="post">
        <table>
            <tr>

                <td colspan="2"><input type="text" name="email"> </td>
            </tr>

            <tr>
                <td><input type="Submit" value="Reset Password">  </td>
                <td><input type="reset" value="Cancel">  </td>
            </tr>

        </table>
    </form>
         </c:otherwise>
</c:choose>

thank you for helping me;

1 个答案:

答案 0 :(得分:0)

问题解决了,有必要更换:

<c:when test="${errorMessage ne null}">

通过

<c:when test="${not empty errorMessage}">