>1/ Can I use EL in my own tags (${loop.count}), if not automatic how?

Yes, http://jakarta.apache.org/commons/el/api/index.html

Are you constructing a list of different types? If so that will complicate
things especially if they
have no common characteristics. If they are all of the same type, you should
be able to interate over them with standard JSTL and Struts tags

-----Original Message-----
From: Mike Whittaker [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 21, 2003 6:51 AM
To: Struts List
Subject: tag writing newbie


I have a List of subclasses that need to be iterated over and rendered in
jsp.

I notice that 'instanceof' is a reserved word in jstl, but has not been
implemented yet. So I now feel the need to write a tag.

On 1st glance I thought custom tag would be limited to Strings, but I see
that I can get at Request object.

So I am proposing this sort of thing:

<c:forEach var="list" items="${myList}" varStatus="loop">
<hp:myTag count="${loop.count}" set="type" />
<c:if test="${type == 'mySubClass'}"> <p>Rendering mySubClass</p> </c:if>
...
</c:forEach>

Then in the tag class

List myList = (List)request.getAttribute("myList")
myList.get(//int from loop.count//)
// do is instanceof
// set variable for tag attribute 'set' ie 'type' to a String indicating
subclass

Questions:
0/ Is there a better/easier way to accomplish this?
1/ Can I use EL in my own tags (${loop.count}), if not automatic how?
2/ Is there a simpler way to get at the objects in my List within tag class,
than this?

--
Mike W



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to