천재 블로그

[JSTL] 비교연산 eq, ne, empty 본문

프로그래밍/JSTL & EL

[JSTL] 비교연산 eq, ne, empty

Dondons 2018. 4. 8. 13:14



JSTL 비교연산 eq, ne, empty




 비교연산

의미 

eq 

equal(==) : 같다

ne 

not equal()  : 같지 않다

 empty

 list, map 등의 객체의 값 유무






사용 방법



[ eq ]

null : <c:if test="${ null eq name}"></c:if>

숫자 : <c:if test="${ 0 eq name}"></c:if>

문자 : <c:if test="${ 'string' eq name}"></c:if>


[ ne(!=) ]

null : <c:if test="${ null ne name}"></c:if>

숫자 : <c:if test="${ 0 eq name}"></c:if>

문자 : <c:if test="${ 'string' eq name}"></c:if>

[ empty ]

객체의 값이 비어있을 때 : <c:if test="${empty map}"></c:if>

객체의 값이 있을 때 : <c:if test="${!empty map}"></c:if>


'프로그래밍 > JSTL & EL' 카테고리의 다른 글

[JSTL] For문 Break  (0) 2018.04.09
[JSTL] if ~ else 문 사용 방법  (0) 2018.04.07
[JSTL] 숫자 Format, 가격 표기하기  (0) 2018.04.03
Comments