「JSTL」空のリスト(list)かどうか調べる方法

書式
${empty リスト名}
${not empty リスト名}
Collectionなどの要素が存在するかどうか調べます。

使用例1
「userList」が空の場合

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<c:if test="${empty userList}">
<c:if test="${empty userList}">
<c:if test="${empty userList}">

使用例2
「userList」が空ではない場合

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<c:if test="${not empty userList}">
<c:if test="${not empty userList}">
<c:if test="${not empty userList}">

 

JSTL

Posted by arkgame