项目结构
application.yml
spring:
mvc:
view:
#jsp页面前缀
prefix: /WEB-INF/
#jsp页面后缀
suffix: .jsp
#静态资源位置
static-path-pattern: /webapp/**
resources:
static-locations: classpath:/webapp
pom.xml<build></build>标签中添加
<!--指定mapper存放路径-->
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<!--引用JS/CSS/JSP页面位置-->
<resource>
<directory>src/main/webapp</directory>
<includes>
<include>**/*.*</include>
</includes>
</resource>
<!--指定配置文件存放路径-->
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.*</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
jsp页面所用依赖
<!--用于编译jsp-->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
jsp页面引用静态资源路径