之前的Spring项目需要转SpringBoot,页面用的JSP,需要配置tomcat-embed-jasper插件才能访问JSP页面否则会变成下载或者404,但是引入之后,会报错找不到jaxws-rt.jar,手动引入此jar包之后又会报错很多jar包找不到,后来偶然找到解决办法。按照如下引入依赖即可
<!-- 引入Spring Boot 内嵌的Tomcat对jsp的解析包-->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<version>7.0.59</version>
<scope>provided</scope>
</dependency>
如下为Springboot访问JSP所需要引入的依赖:
<!-- 引入Spring Boot 内嵌的Tomcat对jsp的解析包-->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<version>7.0.59</version>
<scope>provided</scope>
</dependency>
<!-- servlet 依赖的jar包start-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.3</version>
<scope>provided</scope>
</dependency>
<!-- jsp 依赖的jar包start-->
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
</dependency>
<!-- jstl标签 依赖的jar包start-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>