Which version of JSTL should I use with Struts?

What version of Struts am I using?

If there is no version number in the filename, (i.e., struts-1.2.9.jar,) then look inside WEB-INF/lib/struts.jar (or possibly struts-core.jar) and examine the contents of the MANIFEST.MF file.

What version of the Servlet spec am I using?

Look at the top of WEB-INF/web.xml and compare to the snippets in each section below.

Your Servlet container may support versions other than the one your particular application is using. For example, Tomcat 5.5 supports Servlet 2.4, but will also run applications configured for Servlet 2.3 and (probably, haven't tried it,) Servlet 2.2.

Servlet 2.2

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

Servlet 2.3

* web.xml:

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">

   <%@ taglib uri="http://struts.apache.org/tags-bean-el" prefix="bean" %>
   <%@ taglib uri="http://struts.apache.org/tags-html-el" prefix="html" %>

   <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>

Servlet 2.4

<web-app      xmlns="http://java.sun.com/xml/ns/j2ee"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
                     http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
            version="2.4">

   <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
   <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>

   <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

Notes

What we call "JSTL" is really the JavaServer Pages Standard Tag Library Specification. There is a Reference Implementation available from Sun at the bottom of http://jcp.org/aboutJava/communityprocess/final/jsr052/


Jakarta has an implementation of the specification, called "Jakarta Standard Taglib". (One implementation for each version of the JSTL spec.) And that (the 1.0 verson) is what Struts 1.x distributes with Struts EL.


StrutsAndJSTL (last edited 2009-09-20 23:11:50 by localhost)