zoukankan      html  css  js  c++  java
  • springboot项目中使用jsp

    在pom文件中

    1.方法一

    <!-- 引入tomcate内嵌的jsp解析包-->
    <dependency>
    <groupId>org.apache.tomcat.embed</groupId>
    <artifactId>tomcat-embed-jasper</artifactId>
    </dependency>

    <build>
    <plugins>
    <plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    </plugin>
    </plugins>

    <resources>
    <resource>
    <!-- 源文件位置-->
    <directory>src/main/webapp</directory>
    <!-- 编译到MATA-INF/resources-->
    <targetPath>MATA-INF/resources</targetPath>
    <includes>
    <!-- 把那些文件编译过去 **/*.*表示全部-->
    <include>**/*.*</include>
    </includes>
    </resource>
    </resources>
    </build>

    properties文件中配置

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

    2.====方法二

    可以添加一个外部tomcat启动项目,tomcat启动时会自动启动springboot

    properties文件中配置

    jsp在项目中的路径,前缀

    spring.mvc.view.prefix=/

    后缀
    spring.mvc.view.suffix=.jsp

  • 相关阅读:
    第六次实验报告
    第三次实验报告
    第五张循环语句总结
    第二次实验报告
    第一次实验报告
    第一次作业
    第九章 结构体与共用体
    第八章 指针实验
    第七章数组实验
    第六章实验报告(2)
  • 原文地址:https://www.cnblogs.com/xianz666/p/12554059.html
Copyright © 2011-2022 走看看