You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Amarant Merah <am...@yahoo.com.au> on 2002/06/01 03:59:27 UTC

using ${...} in custom taglib

Hi,

How to use the ${...} expression in our own taglib?

I have this code:
<c:set var="data1">Cambridge</c:set>
<c:set var="data2">London</c:set>
<mycustomtaglib:distance from="${data1}"
to="${data2}"/>

The problem is that within mycustomtaglib, the "from"
attribute gets the value of String "${data1}" instead
of "Cambridge". The same thing with data2.

It works fine if it is used without ${...}
<mycustomtaglib:distance from="Cambridge"
to="London"/>

Regards,
Amarant

=====
Amarant Merah - survive, and fighting.

http://www.sold.com.au - The Sold.com.au Big Brand Sale
- New PCs, notebooks, digital cameras, phones and more ... Sale ends June 12

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: using ${...} in custom taglib

Posted by Pierre Delisle <pi...@sun.com>.
Amarant,

In JSTL 1.0, the EL must be invoked explicitely by a tag that wants to support it.
This is what all the tags in the EL-based versions of the JSTL taglibs do,
and this is why it does not work by default with your custom tag.

When the EL is officially supported by the JSP spec (JSP 1.3), this will then
be handled transparently by the container.

In the meantime, if you really need to support the EL with your custom tags,
see the source code of the RI for examples, as well as class
org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.

    -- Pierre

Amarant Merah wrote:
> 
> Hi,
> 
> How to use the ${...} expression in our own taglib?
> 
> I have this code:
> <c:set var="data1">Cambridge</c:set>
> <c:set var="data2">London</c:set>
> <mycustomtaglib:distance from="${data1}"
> to="${data2}"/>
> 
> The problem is that within mycustomtaglib, the "from"
> attribute gets the value of String "${data1}" instead
> of "Cambridge". The same thing with data2.
> 
> It works fine if it is used without ${...}
> <mycustomtaglib:distance from="Cambridge"
> to="London"/>
> 
> Regards,
> Amarant
> 
> =====
> Amarant Merah - survive, and fighting.
> 
> http://www.sold.com.au - The Sold.com.au Big Brand Sale
> - New PCs, notebooks, digital cameras, phones and more ... Sale ends June 12
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>