[Spring Boot] thymleaf / select box/ 셀렉트 박스 / th:field

seulki·2022년 11월 29일
0

[springboot]

목록 보기
15/27

🎈 select

  • 컨트롤러

  • addForm.html
<div>
	<div>배송방식</div>
	<select th:field="*{deliveryCode}" class="form-select">
			<option value="">=== 배송 방식 선택 ===</option>
			<option th:each="deliveryCode : ${deliveryCodes}" 
                    th:value="${deliveryCode.code}" th:text="${deliveryCode.displayName}">
			</option>
		</select>
</div>



  • 👌 item.html
<!-- select -->
<div>
	<div>배송방식</div>
	<select th:field="${item.deliveryCode}"  class="form-select" disabled>
			<option value="">=== 배송 방식 선택 ===</option>
			<option th:each="deliveryCode : ${deliveryCodes}" th:value="${deliveryCode.code}"
            		th:text="${deliveryCode.displayName}" >
			</option>		
	</select>
</div>

profile
웹 개발자 공부 중

0개의 댓글