1.看了网上很多文章,说是Springboot官方不推荐使用jsp,而推荐使用thymeleaf模版。(使用jsp需要在pom.xml中添加tomcat依赖,servlet依赖,还要修改application.yml/properties文件等等,否则访问会出现404) 搞了半天算是明白不推荐使用的意思,其实是默认不支持,需要手动下载jar包关联,修改配置等等。
2.thymeleaf模版:
既然使用jsp那么复杂,那么就想使用thymeleaf啦,看了网上的教程。首先在pom.xml中添加依赖:
<!-- 统一版本控制 -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
<!-- spring boot 核心 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>