uri: http://java.sun.com/jsp/jstl/core 无法在 web.xml 或使用此应用程序部署的 jar 文件中解析

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20818747/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 04:34:32  来源:igfitidea点击:

uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application

javahtmlmysqlsqljsp

提问by user3116798

JSP, SQL experts, I'm so grateful that I have got working solutions to all my previous posts as I'm a newbie to the above programming languages with just basic college knowledge. After getting the Java - SQL database data extraction working via command line (for basic understanding of JDBC) I have shifted back to 'JSP - SQL database access'.
This is my first example but when i try to execute it I get a XML error message, that I guessis about Role Based Authentication, though I'm not sure. Please I request your assistance preferably with basic steps of the solution.
Below is the error message.

JSP、SQL 专家,我非常感谢我为我以前的所有帖子提供了有效的解决方案,因为我是上述编程语言的新手,只有基本的大学知识。在通过命令行获取 Java - SQL 数据库数据提取工作(用于对 JDBC 的基本了解)后,我已转回​​“JSP - SQL 数据库访问”。
这是我的第一个示例,但是当我尝试执行它时,我收到一条 XML 错误消息,我猜是关于基于角色的身份验证尽管我不确定。请我请求您的帮助,最好是解决方案的基本步骤。
下面是错误信息。

HTTP Status 500 - 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

type Exception report

message 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

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: 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
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:56)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:445)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:117)
org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:311)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:152)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:475)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1427)
org.apache.jasper.compiler.Parser.parse(Parser.java:138)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:242)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.47 logs.
Apache Tomcat/7.0.47  

Here is the JSP code:

这是 JSP 代码:

<%@ page import="java.io.*, java.util.*, java.sql.*" %>  
<%@ page import="javax.servlet.http.*, javax.servlet.*" %>  
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>  
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>    
<html>
<head>
  <title>SELECT operation</title>
</head>
<body>

<sql:setDataSource var="snapshot" driver="com.mysql.jdbc.Driver"
     url="jdbc:mysql://localhost/EMP"
     user="root" password="password"/>

<sql:query dataSource="${snapshot}" var="result">
SELECT * from Employees;
</sql:query>

<table border="1" width="100%">
<tr>
<th>Emp ID</th>
<th>Age</th>
<th>First Name</th>
<th>Last Name</th>

</tr>
<c:forEach var="row" items="${result.rows}">
<tr>
<td><c:out value="${row.id}"/></td>
<td><c:out value="${row.age}"/></td>
<td><c:out value="${row.first}"/></td>
<td><c:out value="${row.last}"/></td>
</tr>
</c:forEach>
</table>
</body>
</html>  

Here are the file and class paths:
JSP page:C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\jsp pages\RegName.jsp

以下是文件和类路径:
JSP 页面:C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\jsp pages\RegName.jsp

CLASSPATH:C:\Program Files\Apache Software Foundation\Tomcat 7.0\lib\jsp-api.jar;C:\glassfish3\jdk\jre\lib;C:\Program Files (x86)\MySQL\MySQL Connector J\mysql-connector-java-5.1.27-bin.jar

类路径:C:\Program Files\Apache Software Foundation\Tomcat 7.0\lib\jsp-api.jar;C:\glassfish3\jdk\jre\lib;C:\Program Files (x86)\MySQL\MySQL Connector J\mysql -connector-java-5.1.27-bin.jar

JAVA_HOME:C:\glassfish3\jdk

JAVA_HOME:C:\glassfish3\jdk

Path:C:\glassfish3\jdk\bin;C:\Program Files (x86)\MySQL\MySQL Server 5.0\bin

路径:C:\glassfish3\jdk\bin;C:\Program Files (x86)\MySQL\MySQL Server 5.0\bin

回答by Sotirios Delimanolis

You need to add the jstllibrary to your classpath. Typically, it would go into WEB-INF/lib. You can get the binary jar here.

您需要将jstl库添加到类路径中。通常,它会进入WEB-INF/lib. 您可以在此处获取二进制 jar 。

回答by Annie Caron

Late answer, but it can help other!

迟到的答案,但它可以帮助其他人!

As stated here, you can add to your pom.xml:

如前所述在这里,你可以添加到您的pom.xml:

<dependency>
    <groupId>jstl</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
</dependency>

It worked for me!

它对我有用!