thymeleaf는 자바 라이브러리이면서 웹, 웹이 아닌 환경에서 html, xml, javascript, css, 텍스트를 생성할수 있는 템플릿 엔진이라고 한다.
기존 java에서는 jsp라는 java server page라는 곳에서 jstl(java standard library)라는 라이브러리를 통해서 앞단과 뒷단데이터를 가져다 사용을 하였다.
하지만 Spring에서는 thymeleaf를 권장하고 있다.
let sessionval = /*[[${session.sessionstate}]]*/ "";
<option th:each="item : ${datalist}" th:value="|${item.num}_${item.name}|" th:utext="${item.name}"></option>
<option th:each="item : ${list에담은값}" th:value="|${item.num}_${item.name}|" th:utext="${item.name}"></option>
위형식으로 호출을 하게되면 java단에서 세션에 담은 객체를 가져올수 있다. 뒤에"" 이런형태로 명시를 해야 해당 세션값을 자바스크립트에서 "세션값" 이런형태로 가져올수 있다.
<button th:href="@{/logout}" type="button" th:id="logout_id" th:class="logout_id" title="로그아웃">로그아웃</button>코드를 입력하세요
<option th:each="item : ${datalist}" th:value="|${item.num}_${item.name}|" th:utext="${item.name}"></option>
<a data-toggle="modal" th:onclick="|javascript:modalfun("A")|" data-target="#modalid">onclick이벤트</a>