On Wed, 9 Oct 2002, David Graham wrote:

> Date: Wed, 09 Oct 2002 18:27:02 -0600
> From: David Graham <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Re: [OT] Re: "Avoid Heavy Use of Logic Tags" ???
>
> Thanks for the info Craig.  I didn't know you didn't have to list them in
> the web.xml file and put the tlds in your app.  Does this apply to any
> taglib on a servlet 2.3 compliant container as long as you use the uri given
> in the tld?

Yes, this should work on any 2.3 container.  The "secret recipie":

* The TLD (or TLDs, because you can have more than one tag library
  in the same JAR) has to be in the META-INF/tlds directory of a JAR
  inside the webapp, and have a "*.tld" extension.

* Each such TLD must include a <uri> element with the canonical URI
  by which this tag library is identified.

* These are the URIs you use in your <%@ taglib %> directives.

Note that JSP 1.1 (which is the minimum required platform for Struts)
allows a single TLD to be stored at "/META-INF/taglib.tld", but that was
not sufficient for Struts since we have several such libraries.  Support
for auto-scanning JAR files was also very inconsistenty implemented in JSP
1.1 containers, so I've stuck with the original style for Struts 1.1
examples and documentation.  Once Struts formally adopts JSP 1.2 or later
as the minimum platform, we'll be able to change that.

>
> Also, I switched from <bean:message> to <fmt:message> but then realized that
> the struts tag will pick the appropriate subapp resources.  Is this the only
> difference from the jstl version?

There's actually somewhat more to it than that for I18N.  Most
importantly, the <fmt:message> tag and its friends work off of resource
bundles, not off of Struts MessageResources objects (although in practice,
since both can operate off the same properties files, this is not a huge
impediment).  In addition, you can dynamically establish the default
resource bundle (and/or locale) for i18n tags in a chunk of a page by
using <fmt:setBundle>, or in a couple of other ways -- see Section 8.2 of
the JSTL spec for details.

>
> I just thought it would be cool if containers recognized how cool struts is
> by optimizing the implementation of custom tags :-).  Big players like IBM
> are putting an increasing emphasis on struts

Indeed -- it was quite a rush for me to see an "Add Struts Support" button
in the latest editions of WSAD :-).  And they aren't the only ones ...

> so maybe in the future we'll
> see this.

Certainly this is a feasible thing to do.  In Tomcat land, one of the
original goals of writing Jasper2 was to enable plugins for things like
this, so it might someday be possible for Struts developers to create such
a plugin (Tomcat-specific, of course, but there's *lots* of Tomcat users).

On the other hand, I'm betting that the containers will go for optimized
support on JSTL (and JavaServer Faces when it's done) before they would
consider this.

>  Although, considering how long it took them to release a 2.3
> compliant Websphere this may be wishful thinking.
>
> Dave

Craig


>
>
> >From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> >To: Struts Users Mailing List <[EMAIL PROTECTED]>
> >Subject: Re: [OT] Re: "Avoid Heavy Use of Logic Tags" ???
> >Date: Wed, 9 Oct 2002 15:02:00 -0700 (PDT)
> >
> >
> >
> >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]>
>
>
>
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>


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

Reply via email to