19 December 2010

Adding JSTL/JSP EL to your web applicaton (updated)

Quite some environments do not come with JSTL: Eclipse for JEE (Galileo), Tomcat 6, Jetty 6... Follow these steps to add them:

  1. Add JSTL
    Grab the JSTL API (jstl-api.jar) and JSTL implementation (jstl-impl-1.2.jar).
    Add the jars to your Container (e.g. Tomcat) lib directory (or your webapp lib).
    Alternatively add them using maven dependencies:
  2. Make sure the web-app root element in web.xml supports at least servlet 2.4/JSP 2.0
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
     http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
    If you use <taglib> elements in web.xml, make sure they are embedded in a <jsp-config> element.