I am just learning JSP and am testing using JSTL on Tomcat 7. I am able to successfully define and use custom tags. But when I attempt to implement JSTL the container throws two exceptions. How can I fix this so the jsp will translate properly?
java.lang.ClassNotFoundException: javax.servlet.jsp.tagext.TagLibraryValidator java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator
I'm using the following jar files.
javax.servlet.jsp.jstl-1.2.1.jar javax.servlet.jsp.jstl-api-1.2.1.jar
I have placed the two JSTL 1.2.1 jars in WEB-INF/lib of the test web app and the CLASSPATH for my JRE. I have also marked the two jars for export in the build path options in Eclipse.
index.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!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>Insert title here</title>
</head>
<body>
<c:out value="JSTL works."></c:out>
</body>
</html>