「Spring」c:ifでnullを判定するサンプル

1.nullを判定する
emptyで変数が空文字またはnullかどうか
<c:if test="${empty var}">
//処理コード
</c:if>

2.not emptyで変数が空文字またはnullではないかどうか
<c:if test="${not empty var}">
//処理コード
</c:if>

<c:if test="${!empty var}">
//処理コード
</c:if>

3.複数条件を判定する
<c:if test="${m >= 21 and m <= 41}">
//処理コード
</c:if>

<c:if test="${length > 15 or length < 6}">
//処理コード
</c:if>

Software

Posted by arkgame