Spring boot 项目不需要项目名,直接localhost:8080/Contoller的请求路劲
主要支持thymleaf
模板:
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8" />
<title>Title</title>
</head>
<body>
hellodsdswdsdsds
</body>
</html>
要支持jsp的话:
1.在建立项目时,不勾选thymeleaf
2.在poml中加入
<!-- JSTL for JSP -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<!-- Need this to compile JSP -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<!-- Need this to compile JSP,
tomcat-embed-jasper version is not working, no idea why -->
<dependency>
3.在application.properties中配置前后缀
spring.mvc.view.prefix:/
spring.mvc.view.suffix:.jsp