I have a dynamic list which is coming from a backend. I am iterating over the loop, displaying the list items in the UI. But now based on the list item value, I need to set the list display order. So how can we set the list order in the for loop?
My code is as follows:
<ul>
<c:forEach var="listObj" items="${resultList.myList}">
<li><a>${listObj.name}</a></li>
</c:forEach>
</ul>
Here the list will always have five values. Let's assume [one, three, five, four, two]. Now based on the name of the list item I need to set the list order. So finally I need to display list items as follows: [one, two, three, four, five].
Any suggestions?