On Wed, 9 Oct 2002, David Graham wrote:

> Date: Wed, 09 Oct 2002 13:54:32 -0600
> From: David Graham <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: [OT] Re: "Avoid Heavy Use of Logic Tags" ???
>
> I read somewhere that you should use http://java.sun.com/jstl/core for the
> taglib uri in your web.xml file for the JSTL libraries (as opposed to
> something you make up like jstl-core).  The author stated that using that
> full uri would allow a container to optimize those tags like you mentioned.
>

Each of the standard tag libraries in JSTl has a canonical URI, as defined
in the JSTL Spec.  These are the URIs for the EL-based versions of the
libraries (which is what you'd use in preference to the RT versions that
do not recognize EL expressions):

Core:               http://java.sun.com/jstl/core

XML:                http://java.sun.com/jstl/xml

I18N & Formatting:  http://java.sun.com/jstl/fmt

SQL:                http://java.sun.com/jstl/sql

It is by the use of these URIs that you specify you are talking about
*the* standard tag libraries.  This is true whether or not your container
has built in optimized support for JSTL or not.

NOTE:  If you use the JSTL RI (or the Apache version of it, the "standard"
tag library from jakarta-taglibs), you'll note that you don't have to
separatel copy the TLDs into your WEB-INF directory as is conventional for
Struts apps.  That's because they are included in the META-INF directory
of the JAR file (supported under Servlet 2.3/JSP 1.2 containers).  You
also don't have to explicitly list these TLDs in your web.xml file -- just
drop the appropriate JARs into /WEB-INF/lib and start using JSTL tags in
your pages.

> First, is that true?  Second, it would be neat if containers optimized
> Struts tags in a similar manner.  Maybe the Tomcat team would be willing to
> do this since they're both on jakarta.
>

Containers have the *opportunity* to provide optimized support for JSTL
tags, and I understand that Resin does this already.  But you can use an
implementation of the JSTL tags on any container, just like any other tag
library, by including it in your app.

As cool as Struts tags are :-), any container developer (including those
building Tomcat) are going to get a lot more bang for the buck by
supporting the standard tag libraries first.  That's one of the main
reasons that I encourage people to migrate to JSTL instead of the
struts-bean and struts-logic equivalents, along with the fact that the
expression language makes these tags substantially more powerful.  For
example, think of what you'd have to do to make this work with the Struts
tags:

  <c:if test="${(cust.status == 'OPEN') || (cust.status == 'ONHOLD')}">
    Customer account is either open or on credit hold
  </c:if>

And in JSP 2.0, you'll be able to use EL expressions anywhere in your
template text, not just in the attribute values of tags that understand
it.  Learning the EL syntax now will give you a head start on the future.

> Dave
>

Craig


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to