[JSTL] if , if else 표현하기

2024. 6. 3. 21:58JSP

jstl에선 c:choose로 if문(c:when, c:otherwise)를 감싼다.

<c:choose> 
	<c:when test="조건"> // c:when (if) 문
    
   	    if 조건문이 true 일때
        
	</c:when>
	<c:otherwise> // c:otherwise (else) 문
    
   	    if 조건문이 flase 일때
        
	</c:otherwise>
</c:choose>

 

c:when 를 여러개 기입하고 마지막에 otherwise 해주면
여러개의 c:when 이 다 false일 경우 otherwise로 들어온다.