springboot+jsp jsp页面在WEB-INF

2020-12-07 14:32:26 浏览数 (1)

项目结构

application.yml

代码语言:javascript复制
spring:  
  mvc:
    view:
      #jsp页面前缀
      prefix: /WEB-INF/
      #jsp页面后缀
      suffix: .jsp
      #静态资源位置
    static-path-pattern: /webapp/**

pom.xml<build></build>标签中添加

代码语言:javascript复制
 <!--指定mapper存放路径-->
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
           
            <!--指定配置文件存放路径-->
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.*</include>
                </includes>
                <filtering>false</filtering>
            </resource>

        </resources>

jsp页面所用依赖

代码语言:javascript复制
<!--用于编译jsp-->
    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-jasper</artifactId>
        <scope>provided</scope>
    </dependency>

jsp页面引用静态资源路径

0 人点赞