我使用的是JDK 1.7,Apache Tomcat 7.0.23,我在WEB_INF lib文件夹中放置了JSTL核心库(1.2)和STANDARD jar,它没有给我任何警告,但是当我尝试运行代码时
<%@ 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">
<!-- Create Bean Instance-->
<jsp:useBean id="listdomain" class="bean.PopulateMultiDomain" scope="session"></jsp:useBean>
<jsp:setProperty property="*" name="listdomain"/>
<c:forEach var="item" items="${listdomain.status}">
<option>
<c:out value="${item}" />
</option>
</c:forEach>
它给了我以下错误:
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:410)
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:1425)
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:722)
有谁能告诉我我犯了什么错误?
答案 0 :(得分:43)
删除standard.jar
。当TLD URI没有/jsp
路径时,它显然是旧的JSTL 1.0版本。有了JSTL 1.2可用here,您根本不需要standard.jar
。只需jstl-1.2.jar
中的/WEB-INF/lib
即可。
答案 1 :(得分:21)
我解决了同样的问题。我刚刚将JSTL-1.2.jar添加到/apache-tomcat-x.x.x/lib
并将范围设置为maven pom.xml中提供的内容:
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
答案 2 :(得分:3)
确保您没有跳过
中的所有广告public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "npCell", for: indexPath) as! NewPlaylistTableViewCell
cell.mTitle.text = musics[indexPath.row]["title"] as! String?
cell.mArtist.text = musics[indexPath.row]["artist"] as! String?
cell.selectionStyle = .none
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let cell = tableView.cellForRow(at: indexPath)
cell?.accessoryType = .checkmark
tableView.reloadData()
}
在Tomcat catalina.properties中。
答案 3 :(得分:2)
有问题的错误也可能是tomcat/conf/context.xml
中已停用的JarScanner造成的。
另见Upgrade from Tomcat 8.0.39 to 8.0.41 results in 'failed to scan' errors。
<JarScanner scanManifest="false"/>
可以避免这两个问题。
答案 4 :(得分:2)
我删除了范围,然后使用maven更新来解决此问题。
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
**<!-- <scope>provided</scope> -->**
</dependency>
The jstl lib is not present in the tomcat lib folder.So we have to include it. 我不明白为什么我们被告知要保持servlet-api和jstl的范围。
答案 5 :(得分:1)
如果您使用eclipse和maven来处理依赖项,则可能需要采取这些额外步骤以确保eclipse正确复制依赖项Maven dependencies not visible in WEB-INF/lib(即动态Web应用程序的部署程序集)
答案 6 :(得分:0)
如果您在application.propertiese
中使用spring boot check,则对该属性添加注释或将其删除(如果存在)。
答案 7 :(得分:0)
这可能是由于传递依赖。
尝试在JSTL库中添加/删除范围。
这对我有用!
答案 8 :(得分:0)
如果您正在使用Maven项目,则只需在依赖项中添加jstl-1.2 jar。如果只是将jar添加到项目中,则jar文件可能未添加到项目项目工件中。您只需要将jar文件添加到WEB-INF / lib文件中即可。
这是未将jstl添加到工件时项目的外观。只需点击修复按钮,intellij将在上述路径中添加jar文件。运行项目并爆炸。
答案 9 :(得分:0)
我也面临相同的问题,为了解决该问题,我在pom.xml
中添加了以下条目,并执行了maven update
。
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>