springmvc升级springboot JSP文件JSTL错误解决(1),


背景:

原springMVC 项目需要升级到springboot中使用.
原来的项目使用JSP

修改后的pom文件内容

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <!--jsp页面使用jstl标签-->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
        </dependency>

        <!--用于编译jsp-->
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <scope>provided</scope>
        </dependency>

错误描述

可以正常编译,打包,运行,解析jsp文件时面页报告
Spring Boot- The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files

错误

org.apache.jasper.JasperException: /incex.jsp(9,62) PWC6188: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:92)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:378)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:172)
.....

查看文件发现是错误是由 <%@include file %>标签引起的

<%@include file="common/header1.jsp"%>

查询后得到两个提示

  • jstl 标签定义没有找到
    解决办法
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <!-- <scope>provided</scope>  删除这个-->
        </dependency>

相关内容