Tuesday, March 25, 2014

Getting JSTL to run within Tomcat and Eclipse

It's very simple to include jstl in your projects, what I do is:
  1. Download jstl-1.2.jar (JSP 2.1 containers only i.e. Tomcat 6, otherwise jstl-1.1.jar) fromhttp://repo1.maven.org/maven2/javax/servlet/jstl/1.2/
    or
    the interfaces (javax.servlet.jsp.jstl-api-1.2.1.jar) from http://search.maven.org/#browse|707331597and the actual implementing classes (javax.servlet.jsp.jstl-1.2.2.jar) fromhttp://search.maven.org/#browse%7C-1002239589.
  2. Copy to your project's WEB-INF/lib directory
  3. Include the following tags in yours jsp's:
    • <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    • <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
    • <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
    • <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
As for eclipse I need to know if your using any framework plugin, I use MyEclipse and it does it automatically for me.

No comments:

Post a Comment