<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
select {
width: 80px;
height: 100px;
}
</style>
</head>
<body>
<h1 th:text="|year : ${year}|"></h1> <!-- request 객체에 저장한 데이터 사용할 때 -->
<h1 th:text="|id : ${session.id}|"></h1> <!-- session 객체에 저장된 데이터 사용할 때-->
<h1 th:text="|email : ${application.email}|"></h1> <!-- application 객체에 저장된 데이터 사용할 때-->
<a href="board.html" th:href="@{/board/list(bno=${bno}, type='L')}">abcabc</a> <!-- url의 쿼리스트링을 만들어줌. -->
<!-- 반복문 사용하기. list에서 하나씩 꺼내서 opt에 담는다-->
<select name="" id="" multiple>
<option th:each="opt : ${list}" th:value="${opt}">[[${opt}]]</option>
</select>
<!-- 블럭 단위로 반복문을 사용하고 싶을 때-->
<th:block th:each="opt : ${list}">
<input type="checkbox" th:value="${opt}">[[${opt}]]<br>
</th:block>
<table border="1px">
<tr th:each="item : ${list}">
<td th:text="${item}"></td>
</tr>
<!-- not if 문. -->
<tr th:unless="${list.size}==0">
<td>게시물이 없습니다.</td>
</tr>
</table>
<h1 th:text="${lastName}">lastName</h1>
<h1>[[${firstName}]]</h1>
<span th:text="${'<i>Yoonki, Kim</i>'}"></span> <!-- 태그를 인식 시키지 않고 텍스트 그대로 나타내고 싶을 때-->
<span th:utext="${'<i>Yoonki, Kim</i>'}"></span> <!-- 태그를 인식시키고 싶을 때-->
<h1 th:text="|My name is ${lastName}, ${firstName}|"></h1> <!-- 문자열 안에 변수 사용하고 싶을 때-->
<!-- 자바스크립트에서 값을 사용할 때 쌍따옴표안에 담아준다-->
<!-- let firstName = "Kim" -->
<script th:inline="javascript">
let firstName = [[${firstName}]]
let lastName = [[${lastName}]]
let arr = [[${list}]]
let userObj = [[${user}]]
</script>
</body>
</html>
'자유' 카테고리의 다른 글
암기를 잘 하는 방법!? (지식을 잘 습득하는 방법) (0) | 2023.07.30 |
---|---|
HTTP 가이드 정리 2장 - URL과 리소스, 3장 - HTTP 메세지 (0) | 2023.06.15 |
HTTP 가이드 정리 5장 - 웹 서버, 6장 - 프락시 (1) | 2023.06.14 |
HTTP 가이드 정리 4장 - 커넥션 관리 (0) | 2023.06.14 |
HTTP 가이드 정리 1장 - HTTP 개관 (0) | 2023.06.14 |