tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Þorgils Völundarson <>
Subject Re: Vector
Date Fri, 16 Aug 2002 10:02:39 GMT
Thank you Hans,

that trick will do for some of the sorting problems I have. By the way 
bought your book and have toasted a lot of bread since ;). My JSP bible.

Xtags has a built in sort function. Might sorting be considered in future 
releases of jstl?

And one more for the weekend, what would be the best way to get a total sum 
of N numbers from a xml query (jstl of course)?

Þorgils Völundarson (if you see the letter Þ it is pronounced Th)

At 08:45 15.8.2002 -0700, you wrote:
>Shawn Bayern wrote:
>>On Thu, 15 Aug 2002, Þorgils Völundarson wrote:
>>>how can I store multiple data items from jstl xml query in a vector to
>>>be used later in a servlet to f.x. sort the data?
>>I'm not sure what "f.x." means, but in general, this sort of operation is
>>probably best performed entirely in a servlet.  Servlets are better suited
>>than JSTL for building and performing complex operations on data
>I agree with Shawn that complex code should go in some other type of
>component, but for simple sorts I sometimes use this trick:
>   <%-- Create a TreeMap: it sorts its keys automatically --%>
>   <jsp:useBean id="sorted" class="java.util.TreeMap" />
>   <%-- Add the values to be sorted as keys in the TreeMap --%>
>   <c:set target="${sorted}" property="z" value="" />
>   <c:set target="${sorted}" property="b" value="" />
>   <c:set target="${sorted}" property="x" value="" />
>   <%-- Use the sorted keys --%>
>   <c:forEach items="${sorted}" var="c">
>     <c:out value="${c.key}" />
>   </c:forEach>
>Hans Bergsten 
>Gefion Software
>JavaServer Pages
>To unsubscribe, e-mail:   <>
>For additional commands, e-mail: <>

Þorgils Völundarson
Krabbameinsfélag Íslands, Krabbameinsskrá
Beinn sími: 540 1973
gsm: 698 5302

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

View raw message