如何将jstl中的null与变量进行比较?
how to compare null in jstl with variable?
y的值为null,但总是执行otherwise部分。部分。 null 被认为不为空。
<c:choose>
<c:when test="${empty y}">
value=""
</c:when>
<c:otherwise>
value="${y}"
</c:otherwise>
如果 y
是字符串,请像这样编写代码
<c:choose>
<c:when test="${y==null || y==''}">
value=""
</c:when>
<c:otherwise>
value="${y}"
</c:otherwise>
</c:choose>
y的值为null,但总是执行otherwise部分。部分。 null 被认为不为空。
<c:choose>
<c:when test="${empty y}">
value=""
</c:when>
<c:otherwise>
value="${y}"
</c:otherwise>
如果 y
是字符串,请像这样编写代码
<c:choose>
<c:when test="${y==null || y==''}">
value=""
</c:when>
<c:otherwise>
value="${y}"
</c:otherwise>
</c:choose>