我在web.xml中的配置如下:
<jsp-config>
<taglib> 
       <taglib-uri>http://java.sun.com/jstl/core</taglib-uri> 
       <taglib-location>/WEB-INF/c.tld</taglib-location> 
  </taglib>
  </jsp-config>
代码如下:
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>测试你的第一个使用到JSTL的网页</title>
</head>
<body>
<c:out value="欢迎测试你的第一个使用到JSTL的网页"/>
<br>你使用的浏览器是:<br>
<c:out value="${header['User-Agent']}}"/>
<c:out value="David O'Davies" escapeXml="true"/>
</body>
</html>
运行会出现如下问题:
type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: Unable to read TLD "META-INF/c.tld" from JAR file "file:/E:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Test/WEB-INF/lib/standard.jar": org.apache.jasper.JasperException: Failed to load or instantiate TagLibraryValidator class: org.apache.taglibs.standard.tlv.JstlCoreTLV
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:181)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:182)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:420)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:476)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1426)
org.apache.jasper.compiler.Parser.parse(Parser.java:133)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:216)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:167)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:306)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
我很纳闷:c.tld的已经放到了web-inf目录下了,为什么不能读取呢?请各位高手赐教,先谢了!