tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karr, David" <David.K...@wamu.net>
Subject RE: writing a custom tag that can use EL
Date Wed, 03 Sep 2003 19:42:43 GMT
> -----Original Message-----
> From: Eric W Hauser [mailto:ehauser@indiana.edu] 
> 
> On Wed, 3 Sep 2003, Felipe Leme wrote:
> 
> > - you *have* to add the code that evaluates the expression. 
> With JSP 2.0 you 
> > won't need to, it's done automatically
> 
> Although this is obviously a valid point, waiting for JSP 2.0 is not
> really a good solution for the present.  Especially if you 
> are someone who
> is programming for a container such a Websphere, meaning that 
> you probably
> won't see JSP 2.0 for over another year.  If you're lucky 
> enough to use
> something like Resin, you'll probably have access to a 1.4 
> container in
> the next month, but I people will have access to use this in the near
> future.
> 
> > - the settters of your tag ahndler have to take an String 
> as parameter, even 
> > if the expression will be evaluated in another type (for 
> instance, the value 
> > attribute on <fmt:formatDate> is a java.util.Date)
> 
> Yes, I agree this is more work.  But more work programming your taglib
> isn't necessarily a bad thing, especially if it is going to 
> save you time
> down the road by eliminating annoying and lengthy scriptlets.

One mitigation strategy that can help (which I somewhat accidently
implemented) is if you have (or implement) a tag library that doesn't
depend on the EL, and then you write a "<taglib>-el" library that
extends the original tag library.  The process to do this (write an "el"
version of a taglib) is very straightforward (just look at the
"struts-el" implementation).  In fact, it's feasible to consider writing
code to generate the "el" version of a tag library.  I've started to
write this, but I may not find enough spare time to do this before JSP
2.0 is released, making this moot.

If you use this strategy, you can concentrate your "business logic" in
the non-el library, and then when JSP 2.0 is available, you can drop the
"el" library.

Mime
View raw message