Differences between revisions 1 and 2
Revision 1 as of 2006-07-21 17:32:36
Size: 2723
Editor: wsmoak
Comment: Moved content from http://wiki.wsmoak.net/cgi-bin/wiki.pl?StrutsAndJSTL
Revision 2 as of 2009-09-20 23:11:50
Size: 2727
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 80: Line 80:
 * [http://jakarta.apache.org/taglibs/doc/standard-1.0-doc/intro.html Jakarta Standard Taglib 1.0]
 * [http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html Jakarta Standard Taglib 1.1]
 * [[http://jakarta.apache.org/taglibs/doc/standard-1.0-doc/intro.html|Jakarta Standard Taglib 1.0]]
 * [[http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html|Jakarta Standard Taglib 1.1]]

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

  • web.xml

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
  • You will not be able to use JSTL unless you move to (at least) Servlet 2.3

Servlet 2.3

* web.xml:

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
  • Struts-EL

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

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

Servlet 2.4

  • web.xml:

<web-app      xmlns="http://java.sun.com/xml/ns/j2ee"
  • Struts ("original" taglib, not struts-el)

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

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


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)