Re: JSTL-EL question (instanceOf)

"Martin Cooper" <[email protected]>
Newsgroups gmane.comp.jakarta.taglibs.user
Message-ID <[email protected]>
On 3/16/06, Luca Passani <[email protected]> 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: [email protected]
> For additional commands, e-mail: [email protected]
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.