如何在一个 <c:if>中检查两个条件? 我尝试了这个方法,但它提出了一个错误:
<c:if>
<c:if test="${ISAJAX == 0} && ${ISDATE == 0}">
This look like a duplicate of JSTL conditional check.
The error is having the && outside the expression. Instead use
&&
<c:if test="${ISAJAX == 0 && ISDATE == 0}">
If you are using JSP 2.0 and above It will come with the EL support: so that you can write in plain english and use and with empty operators to write your test:
and
empty
<c:if test="${(empty object_1.attribute_A) and (empty object_2.attribute_B)}">
Recommendation:
when you have more than one condition with and and or is better separate with () to avoid verification problems
or
()
<c:if test="${(not validID) and (addressIso == 'US' or addressIso == 'BR')}">
Just in case somebody needs to check the condition from session.Usage of or
<c:if test="${sessionScope['roleid'] == 1 || sessionScope['roleid'] == 4}">