tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pierre Delisle <>
Subject Re: JSTL and sort ordering of the item in the Result object.
Date Wed, 09 Oct 2002 21:35:13 GMT
Stefan wrote:
> My previous email was a little too vague so I will try again.
> I am populating a JSTL Result object with a cached Rowset derived from a bean method
like so:
> Result r = ResultSupport.toResult(dataBase.getAllUsers());
> pageContext.setAttribute("r", r);
> I then loop though the records with a forEach tag:
> <c:forEach items="${row}" var="value">
>     <td><c:out value="${value}"/>&nbsp;</td>
> </c:forEach>
> Is there a way (within the Result object) to set the order of the records displayed by
the forEach tag? I basically like to imitate an SQL ' order by ' without having to go back
to the database.

No. See below for a reply that Shawn sent a few months
ago on a similar question.

    -- Pierre

-------- Original Message --------
Subject: Re: jstl sort
Date: Tue, 6 Aug 2002 08:46:45 -0400 (EDT)
From: Shawn Bayern <>
Reply-To: "Tag Libraries Users List" <>
To: Tag Libraries Users List <>

On Tue, 6 Aug 2002, Þorgils Völundarson wrote:

> Is it possible to sort information from jstl x:forEach?

JSTL's <x:forEach> tag always uses the order of the node-set returned from
the XPath 'select' attribute.  JSTL's <c:forEach> always returns the items
in collection order.  In JSTL 1.0, there isn't a way to modify this
behavior.  The best thing to do is to sort the collection or node-set
outside of your JSP page (e.g., in a servlet) and then expose the sorted
collection to your page.

Shawn Bayern
"JSTL in Action"

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message