본문 바로가기
유용한 사이트 및 정보

<c:choose> , <c:when> EL태그 끼리 비교할 시 예제

by pyogowoon 2023. 2. 4.

 

만약 ${principal.user.username} 과 ${list.commentUser} 를 비교하고 싶으면

 

아래처럼 하면 된다.

 

 

<c:choose>


   <c:when test="${principal.user.username ==  list.commentUser}">
    <span class="delete" onclick="deleteButton(${list.id})" style="cursor:pointer; cursor:hand;"> X</span>
   </c:when>
   
   
   <c:otherwise>
<span class="delete"> </span>
   </c:otherwise>
   
   </c:choose>

 

댓글