目前市面上用springboot和jsp开发的已经不多,因为jsp有加载的速度慢,每次启动工程重新编译等问题。springboot官网也不太推荐使用jsp,他们推荐使用静态模板,比如Thymeleaf等。但是目前还是有一部分老项目或者少部分公司采用此方式,我们简单了解一下。
首先我们将之前的集成springmvc的代码copy一份,稍作改造,pom依赖如下:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.6.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId