input tag에 타임리프로 chekced를 넣는 방법
미해결
스프링 MVC 2편 - 백엔드 웹 개발 활용 기술
[질문 내용] 안녕하세요 강사님! 강의 잘 듣고 있습니다. 다름이 아니라 타임리프에서 chekced를 표기하는 방법을 알고 싶습니다! html 소스보기 사진 <div class="form-check form-check-inline"> <input type="radio" value="ETC" class="form-check-input" id="itemType3" name="itemType" /> <label for="itemType3" class="form-check-label" checked="checked" >기타</label> </div> 소스코드 <!-- radio button --> <div> <div>상품 종류</div> <div th:each="type : ${itemTypes}" class="form-check form-check-inline"> <input type="radio" th:field="*{itemType}" th:value="${type.name()}" class="form-check-input" th:checked="${(type.description == '기타')? 'true':'false'}" /> <label th:for="${#ids.prev('itemType')}" th:text="${type.description}" class="form-check-label" th:checked="${(type.description == '기타')? 'true':'false'}" > BOOK </label> </div> </div> 위처럼 표시했는데 label 태그에는 나오고 input태그에는 나오지가 않습니다 ㅠ 이유가 무엇일까요? 또 thymeleaf로 표기하려면 어떻게 해야할까요? 그리고 formController에서 초기값을 설정하는 방법은 직접 해봤습니다! 타임리프에서 조건을 줘서 checked를 주는 방식이 궁금합니다! 감사합니다 ㅎㅎ
- tyhmeleaf
- checcked
- MVC
- input
- spring
- html





