极致简单 springboot整合thymeleaf

2023-05-16

1 pom.xml添加thymeleaf依赖

<!-- thymeleaf-->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!-- thymeleaf end-->

2 model
在这里插入图片描述

3 view

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form action="index2" method="post">
    <label>用户</label><input type="text" id="user" name="user" th:value="${user}"/><br>
    <label>密码</label><input type="text" id="password" name="password" th:value="${password}"/><br>
    <input type="submit" value="提交">
</form>
</body>
</html>

4测试
在这里插入图片描述

Successfully.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

极致简单 springboot整合thymeleaf 的相关文章

随机推荐