>I have several pages in my app that display a list of items
>and I want to format them all in the same way - but each
>page displays different things.
>So I could have the foreach loop on each page, but then I
>would be repeating the wrapper formatting on each page too.
>By using the tag file, I put the standard formatting in there.
>My workaround has been to use c:set to set a "global" variable
>before calling the tagfile and then using it internally.
I almost guessed that was the reason you wanted to create a specifik
tag.
Could it be that you try to iterate over a Map? Afaik a Map value is
accessed in a fashion different from Lists. You must reference the
values in the Map on the form ${var.value} where a List value is
accessed just as ${var}. From there on the get for example the
Person.getName() you should be able to say ${var.value.name}.
------------------------------------------------------------------
Example 1:
<c:forEach items="${myMap}" var="m">
Key: ${m.key} Value: ${m.value}
</c:forEach>
<c:forEach items="${myList}" var="l">
Value: ${l}
</c:forEach>
------------------------------------------------------------------
Example 2 (tag):
<?xml version="1.0" encoding="UTF-8"?>
<jsp:root
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:tags="urn:jsptagdir:/WEB-INF/tags"
version="2.0">
<jsp:directive.attribute name="objects"
type="java.lang.Object"
required="true"/>
<!-- Start the tag rendering -->
<c:forEach items="${objects}" var="item">
Value: ${item}
</c:forEach>
</jsp:root>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant archives, FAQs and Forums on JSPs can be found at:
http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com