I want to check two attributes sent from server if they are empty or not in jsp using jstl tag c:if . For example I can use to check if error is empty : <c:if test="${not empty error}"></c:if>
Like this , I want to check two objects error and logout at once to make a div if either of them is empty. How can I do this ?
答案 0 :(得分:1)
使用AND运算符&amp;&amp;或OR运算符||
<c:if test="${not empty first && not empty second}"></c:if>
<c:if test="${not empty first || not empty second}"></c:if>
如果你想要它们是空的
<c:if test="${empty first && empty second}"></c:if>
<c:if test="${empty first || empty second}"></c:if>