美文网首页
玩转springboot之SpringBoot使用jsp

玩转springboot之SpringBoot使用jsp

作者: 墨线宝 | 来源:发表于2024-07-11 10:00 被阅读0次

SpringBoot使用jsp

  • 需要添加jsp解析器依赖

    <!-- jsp -->
    <dependency>
       <groupId>org.apache.tomcat.embed</groupId>
       <artifactId>tomcat-embed-jasper</artifactId>
    </dependency>
    
  • 配置资源目录

    <!-- build标签中 -->
    <!-- jsp文件资源目录 -->
    <resources>
       <resource>
          <directory>src/main/webapp</directory>
          <targetPath>META-INF/resources</targetPath>
          <includes>
             <include>**/*.*</include>
          </includes>
       </resource>
    </resources>
    
  • 注册视图解析器,前缀后缀

    spring:
      mvc:
        view:
          prefix: /
          suffix: .jsp
    

https://zhhll.icu/2022/框架/springboot/基础/18.springboot使用jsp/

本文由mdnice多平台发布

相关文章

网友评论

      本文标题:玩转springboot之SpringBoot使用jsp

      本文链接:https://www.haomeiwen.com/subject/pyxxhjtx.html