tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hans Bergsten <>
Subject Re: Alternatives to this hack ?
Date Sun, 10 Nov 2002 21:05:11 GMT
Shawn Bayern wrote:
> On Sat, 9 Nov 2002, Paul Campbell wrote:
>>First, I just used the JSTL taglibs-mailer for the first time.  It was
>>remarkable how easy and effective it was.
> Just a quick correction.  The Mailer Taglib is not part of JSTL.  It's an
> offering from Jakarta Taglibs, which is not identical with JSTL.
>>does not provide a technique to execute a method 
>>such at <% ef.doToString(); %> which I could use
>>in the EL based mailer or assign to a variable.
>>Is there a better way of executing a method that returns
>>a sting into an EL variable?
> The Mailer Taglib doesn't support the JSTL EL, and the EL in JSTL 1.0
> won't let you access that method unless you provide a wrapper class.  In
> JSP 2.0, you'll be able to associate that method with a function.

Shawn is of course correct. I just wanted to add one more piece of
advice, in case you want to do something similar with a tag library
that _do_ support the EL.

Like Shawn said, there's no way to call a method with the EL in JSTL
1.0, so there's no replacement for <% ef.doToString(); %>. But based
on your description what this method does ("doToString normalizes and
concatenates a string into a member done"), I suggest you rewrite it
as a method named getString() and let it return the normalized String
instead of saving it in an instance variable. The EL calls methods
that correspond to JavaBeans property getter methods (i.e. that starts
with "get"), so you can then get the normalized String with an EL
expression like this:


As long as a method doesn't take any arguments, you can use this
approach no matter what the return type is (i.e. it doesn't have to
return a String).

Hans Bergsten
Gefion Software
JavaServer Pages

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message