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]