springboot整合jsp

springboot默认支持的视图层模板是thymeleaf

1.配置视图解析器

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

2.jsp的解析支持  jsp-servlet-html 由tomcat完成

让内嵌的tomcat去支持jsp的解析工作

<!-- 给内嵌的tomcat添加jsp解析引擎-->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>

3.以插件方式启动

4.页面的热部署

server:
  jsp-servlet:
    init-parameters: 
      development: true

热部署的意思:

在springboot中默认对jsp运行为生产模式,不允许修改内容保存后立即生效,因此在开发过程需要调试jsp页面每次需要重新启动服务器这样极大影响了我们的效率,为此springboot中提供了可以将默认的生产模式修改为调试模式,改为调试模式后就可以保存立即生效,如何配置为测试模式需要在配置文件中加入如下配置即可修改为开发模式。

 



原文地址:https://www.cnblogs.com/ghwq/p/12623080.html