Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

jstl sorting Arraylist

829468Jan 7 2011 — edited Jan 9 2011
i have used jstl to iterate Arraylist to display car name,price and other details.
Can anyone help me in sorting out the table based on list box value selected.ie sort by name,sort by model,sort by price,,
please suggest me ,if it can be done using any taglib

------------------------------------------------------------------------------
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<body>
<h1>Car List</h1>

<h1></h1>
<select>
<option>Sort by Name</option>
<option>Sort by Model</option>
<option>Sort by Price</option>
</select>

<table>

<c:forEach items="${carList}" var="car">
<tr>
${car.brand.name} ${car.model}: ${car.price}
</tr>
</c:forEach>
</table>
</body>
</html>
----------------------------------------------------------------------------------------------------------------
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 6 2011
Added on Jan 7 2011
1 comment
3,191 views