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}"/> </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 <[EMAIL PROTECTED]> Reply-To: "Tag Libraries Users List" <[EMAIL PROTECTED]> To: Tag Libraries Users List <[EMAIL PROTECTED]> 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" http://www.jstlbook.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>