-
在pom.xml文件中加入
-
<!-- thymeleaf 模板 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency>
在以下文件中加入以下代码
spring.mvc.view.prefix=/templates spring.mvc.view.suffix=.html
-
在 template目录下 加入
add.html中为
<form method="get" action="/stu/save" >
班组编码<input type="text" name="code" />
班组名称<input type="text" id="unitName" name="name" />
<input name="submit" type="submit" value="提交">
</form>
在控制器中加入
访问效果:
提交到 save 方法
只需要在 service 层加入