-Bill Siggelkow
Craig Dickson wrote:
I understand this suggestion. However, in the particular scenario I am dealing with, the Collection is not part of the business layer.
For example, we want to print out the request headers on an error page for debugging purposes. We want the headers to print out in name order for ease of reading and finding specific headers in what is sometimes a long list. Using JSTL with the built in EL, we could do something like this:
<c:forEach items="${headers}" var="current"> <tr> <td><c:out value="${current.name}"/></td> <td><c:out value="${current.value}"/></td> </tr> </c:forEach>
In this case the value of "headers" is made available through the EL (obviously I could grab the headers in a servlet prior to the JSP and sort them and put them in the request, but we are trying to avoid all of that hassle if possible).
This is just one example where having the tag itself to the sorting would be advantageous.
Bill Siggelkow wrote on 9/8/2004, 10:23 AM:
> Do it in the business layer that fetches the collection -- or in the > database -- or store the data in a sorted collection (like SortedTreeMap > or some similar animal). > > Craig Dickson wrote: > > > Hi, > > > > Is there an easy way to have the JSTL forEach tag sort the > collection of > > items before looping through them? Currently I have a scriptlet > doing it > > before the loop tag, but this is pretty ugly. > > > > Thanks > > > --------------------------------------------------------------------- > 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]