wintertreey 님의 블로그

삼항연산자 본문

프로그래밍언어/Java

삼항연산자

wintertreey 2025. 5. 23. 17:50

 

형태는 파악 완료.

 

다양한 예시를 파악해보자.

 

 

값이 null이면 회색으로, 값이 있다면 투명으로.

 

<input type="text" th:style="*{col} == null ? 'background-color: gray' : 'background-color: transparent'">

 

citycode가 02와 같다면, 서울 아니면 한국.

 

<span th:text="${#strings.equals(param.citycode,'02') ? '서울' : '한국}">나라/지역</span>

'프로그래밍언어 > Java' 카테고리의 다른 글

thymeleaf, input의 disabled  (1) 2025.05.23
equals(), ==, ===  (0) 2025.05.23
break continue, for if try catch  (0) 2025.01.05