더북(TheBook)

이제 코드 3-2와 같이 로그인 페이지용 Thymeleaf 템플릿을 생성한다.

 

코드 3-2 로그인 페이지용 Thymeleaf 템플릿(resources/templates/login.html)

<!DOCTYPE html>
<html>
<head>
    <title>Login</title>
    <link rel=“stylesheet” th:href=”@{/css/style.css}”></link>
</head>
<body onload=document.f.username.focus();>
    <div id=“loginForm”>
        <h3>Login With Username and Password</h3>
        <div class=“error” th:if=”${param.error}”>
            Incorrect username or password. Try again.
        </div>
 
        <form name=‘f’ th:action=”@{/login}” method=POST>
            <table>
                <tr>
                    <td>User:</td>
                    <td><input type=text name=username value=/></td>
                </tr>
                <tr>
                    <td>Password:</td>
                    <td><input type=password name=password/></td>
                </tr>
                <tr>
                    <td colspan=‘2’><input name=“submit” type=“submit” value=“Login”/></td>
                </tr>
            </table>
        </form>
    </div>
</body>
</html>

신간 소식 구독하기
뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.