[Thymeleaf] 검증오류 (th:errors, th:errorclass)
th:errors모델의 속성이 유효성 검사를 통과하지 못했을경우, html에 표현됨#fields.hasErrors('속성') 을 이용해서, 유효성 검사의 유무를 파악 (오류가 있을경우, fields에 지정해둔 msg가 출력 )주로, 오류 메시지를 표시하는 역할 이름 th:errorclass유효성 검사 오류시, css 를 적용시키기 위한 속성값주로, 시각적으로 오류가 나타남을 표시하는 역할th:errors 와 th:errorclass는 같이 사용되는 경우가 많다 이름 검증의 경우,spring과 연계되어 작업되는 경우가 많으므로, spring controller의 작성도 중요시여기게 된다fields와 같은 역할도 결국, 서버에서 지정해줘야한다. (Binding..
2024. 10. 18.
[Thymeleaf] 속성, 반복, 조건 (th:*, th:each,th:if)
속성 덮어쓰기기존, html 속성을 th:~ 로 표현할경우 th로 설정한 값으로 대체된다ex)타임리프 렌더링 후 -> 로 렌더링 반복th:each=" [변수] : ${[넘어온 값]}"userStatthymeleaf에서 제공해주는 상태값 확인index, count, size, event, odd, first, last ,current 지원 username age username 0 index= null, count= null, size= null, even= null, ..
2024. 10. 17.