You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by David Graham <dg...@hotmail.com> on 2002/10/09 21:54:32 UTC
[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.
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.
Dave
>From: Eddie Bush <ek...@swbell.net>
>Reply-To: "Struts Users Mailing List" <st...@jakarta.apache.org>
>To: Struts Users Mailing List <st...@jakarta.apache.org>
>Subject: Re: "Avoid Heavy Use of Logic Tags" ???
>Date: Wed, 09 Oct 2002 12:25:08 -0500
>
>... and now that we have the JSTL you can have your tags optimized into
>actual code. It's my understanding, for example, that a forEach tag would
>be translated into an actual while (or was it for ... anyway, you get the
>point). So, you're bypassing the tag-usage overhead some.
>
>Hopefully Martin will see this and elaborate (and correct me if I'm wrong).
> I believe that's fairly close though ...
>
>Of course - not all of us are on containers that even support the JSTL ...
>but some of us are :-)
>
>Robert wrote:
>
>>I think that statement "Using custom tags for logic provides little
>>benefit..." is bit vague. I would say that custom tags the do
>>PRESENTATION logic are of benefit, e.g. iterators, formatting, html
>>controls, etc. all fit into that category for me. You are right, you
>>have to do it somehow, where otherwise you end up with just static HTML
>>right?
>>
>>I'm not sure why he would say that XML syntax is more difficult to
>>maintain than other types. That is probably more of an 'eye of the
>>beholder' issue. If you have web developers that are unfamiliar with
>>Java, then the XML syntax is probably easier than a bunch of scriptlets,
>>no? Personally I think it is a lot easier to read than other dynamic
>>page systems (ASP, PHP, etc.), but that is just me.
>>
>>- Robert
>>
>--
>Eddie Bush
>
>
>
>
>--
>To unsubscribe, e-mail:
><ma...@jakarta.apache.org>
>For additional commands, e-mail:
><ma...@jakarta.apache.org>
_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: [OT] Re: "Avoid Heavy Use of Logic Tags" ???
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Wed, 9 Oct 2002, David Graham wrote:
> Date: Wed, 09 Oct 2002 13:54:32 -0600
> From: David Graham <dg...@hotmail.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: struts-user@jakarta.apache.org
> 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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>