<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="https://www.thymeleaf.org">
<head>
<title>Please Log In</title>
</head>
<body>
<h1>Please Log In</h1>
<div th:if="${param.error}">
Invalid username and password.</div>
<div th:if="${param.logout}">
You have been logged out.</div>
<form th:action="@{/login}" method="post">
<div>
<input type="text" name="username" placeholder="Username"/>
</div>
<div>
<input type="password" name="password" placeholder="Password"/>
</div>
<input type="submit" value="Log in" />
</form>
</body>
</html>
form에 th:action을 사용 시 csrf 토큰이 자동으로 추가됩니다.
'Thymeleaf' 카테고리의 다른 글
[Thymeleaf] th:field와 th:value 주의점 (0) | 2023.07.27 |
---|---|
[Thymeleaf] 타임리프 날짜포맷 활용하기 (0) | 2023.06.01 |
[Thymeleaf] 자바스크립트 안에서 loop 돌기 (0) | 2023.05.30 |
[Thymeleaf] 타임리프를 활용하여 스프링 모델 값 가져오기 (0) | 2023.05.24 |
[Thymeleaf] LocalDate 원하는 날짜 형식으로 출력하기 (0) | 2022.09.13 |