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 Luca Passani <pa...@eunet.no> on 2006/03/17 00:39:18 UTC
JSTL-EL question (instanceOf)
Hi
here is my problem today. I am dealing with an API that I have not
written and that is not very object oriented.
I have a list of objects that have no common super class (or better,
they have Object).
In my JSP, which I would love to keep scriptlets-free, I need to loop
through the list and treat each object differently depending on the
type. Is there a way to do instanceOf using EL?
<c:forEach var="item" items="${content_list}">
<c:if test="${item.instanceOf(MySpecialClass)}">
render my special class
</c:if>
:
it should work on the same version of JSP supported by Tomcat 4 (1.2 if
my memory doesn't fail me).
Thanks
Luca
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
Re: JSTL-EL question (instanceOf)
Posted by Martin Cooper <ma...@apache.org>.
On 3/16/06, Luca Passani <pa...@eunet.no> wrote:
>
> Martin Cooper wrote:
>
> >
> >Not with just EL, but see:
> >
> >
> http://jakarta.apache.org/taglibs/sandbox/doc/unstandard-doc/index.html#instanceOf
> >
> >
> >
> that seems powerful. Thanks. Is there an example of usage somewhere?
> how do I combine this with <c:if test>?
Dunno. Sorry. I haven't used it, I just knew it was there. ;-)
--
Martin Cooper
Luca
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>
>
Re: JSTL-EL question (instanceOf)
Posted by Luca Passani <pa...@eunet.no>.
Martin Cooper wrote:
>
>Not with just EL, but see:
>
>http://jakarta.apache.org/taglibs/sandbox/doc/unstandard-doc/index.html#instanceOf
>
>
>
that seems powerful. Thanks. Is there an example of usage somewhere?
how do I combine this with <c:if test>?
Luca
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
Re: JSTL-EL question (instanceOf)
Posted by Martin Cooper <ma...@apache.org>.
On 3/16/06, Luca Passani <pa...@eunet.no> wrote:
>
> Hi
>
> here is my problem today. I am dealing with an API that I have not
> written and that is not very object oriented.
>
> I have a list of objects that have no common super class (or better,
> they have Object).
> In my JSP, which I would love to keep scriptlets-free, I need to loop
> through the list and treat each object differently depending on the
> type. Is there a way to do instanceOf using EL?
Not with just EL, but see:
http://jakarta.apache.org/taglibs/sandbox/doc/unstandard-doc/index.html#instanceOf
--
Martin Cooper
<c:forEach var="item" items="${content_list}">
> <c:if test="${item.instanceOf(MySpecialClass)}">
> render my special class
> </c:if>
> :
>
> it should work on the same version of JSP supported by Tomcat 4 (1.2 if
> my memory doesn't fail me).
>
> Thanks
>
> Luca
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>
>