1.创建webapp目录如图所示
2.配置该目录为web目录
3.pom.xml中添加jsp依赖
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
4.application.yml中配置前后缀
server:
port: 9999
spring:
freemarker:
cache: false
thymeleaf:
cache: true
devtools:
restart:
enabled: true
additional-paths: src/main/java
exclude: WEB-INF/**
mvc:
view:
prefix: /WEB-INF/jsp/
suffix: .jsp
5. controller层简单应用示例
@RequestMapping("/jsp/index")
public ModelAndView getIndex(ModelAndView modelAndView){
modelAndView.setViewName("index");
modelAndView.addObject("userlist",userDao.allConditionSelectUser());
return modelAndView;
}