我想使用jstl标记c:if检查从服务器发送的两个属性是否为空。例如,我可以使用来检查错误是否为空: <c:if test="${not empty error}"></c:if> 像这样,我想检查两个对象的错误,如果其中一个为空,则立即注销以创建一个div。我该怎么做?
<c:if test="${not empty error}"></c:if>
使用和操作员&&或运算符||
<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>