• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error while executing JSTL

 
deepashree deval
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@page isELIgnored='false' %>
<%@ taglib uri="/core" prefix="c" %>
<HTML>
<BODY>
<b> List of Locations : </b>
<br><br>
<table>
<c:forEach var="location" items="${location}">
<tr>
<td> ${location"}</td>
</tr>
</c:forEach>

HEllo

</table>
</BODY>
</HTML>

I am dispatching my request from a servlet to the jsp page shown above , but while executing this page , it gives me an error stating :
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:281)
org.apache.jasper.compiler.TagLibraryInfoImpl.createValidator(TagLibraryInfoImpl.java:662)
org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:247)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:163)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:424)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:493)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1557)
org.apache.jasper.compiler.Parser.parse(Parser.java:127)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:212)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:156)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:296)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root cause

java.lang.ClassNotFoundException: org.apache.taglibs.standard.tlv.JstlCoreTLV
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1362)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1208)
org.apache.jasper.compiler.TagLibraryInfoImpl.createValidator(TagLibraryInfoImpl.java:658)
org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:247)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:163)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:424)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:493)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1557)
org.apache.jasper.compiler.Parser.parse(Parser.java:127)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:212)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:156)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:296)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

I have added c.tld , c-rt.tld ,fmt.tld ,fmt-rt.tld ,sql.tld ,sql-rt.tld ,
x.tld ,x-rt.tld into my web-inf and also made an entry into web.xml . please can anybody give me a solution for this problem.
I am using tomcat 5.5 , jsp 2.0
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by deepashree deval:
<%@ taglib uri="/core" prefix="c" %>

Wrong, it should be

Also see the http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/index.html

root cause
java.lang.ClassNotFoundException: org.apache.taglibs.standard.tlv.JstlCoreTLV

The mentioned class is missing in your classpath. It's part of the JSTL API. In case of JSTL 1.1 You need to place the jstl.jar and standard.jar in your classpath. In a normal webapp, just place it in the /WEB-INF/lib.


I have added c.tld , c-rt.tld ,fmt.tld ,fmt-rt.tld ,sql.tld ,sql-rt.tld ,
x.tld ,x-rt.tld into my web-inf and also made an entry into web.xml .

Terrible. Remove them all. Remove any tld files and web.xml entries regarding to JSTL. It is totally not needed and would possibly only lead to trouble.

Just place the JSTL JAR(s) in your classpath and declare the JSTL taglib in your JSP page. Nothing more than that.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are two jars, jstl.jar and standard.jar that need to be placed in WEB-INF/lib. As pointed out, remove all that other garbage.

Also make sure that you did not copy the servlet and js api jars to WEB-INF/lib.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic