2.5 SpringBoot中使用jsp(不推荐,默认:不支持jsp)
jsp使用较少了,一般使用模板技术--->Thymeleaf
如果需要使用jsp:
1)加入处理jsp的依赖-->负责编译jsp文件
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
若需要使用servlet,jsp,jstl的功能
还需要加入对应的依赖
<!--jstl-->
<dependency>
<groupId>java.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<!--servlet jsp-->
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
</dependency>
2)创建一个存放jsp的目录,一般叫做webapp
例如index.jsp
3)需要在pom文件中指定jsp文件编译后的存放目录
META-INF/resources
4)创建controller,访问jsp
5)在application.properties文件中配置视图解析器