I am using strus2 tags in a jsp to iterate over a collection:
<s:if test="parent.entries.size > 0">
<table border="3">
<s:iterator value="parent.entries">
<tr />
<td><s:property value="entry"></td>
<td><s:property value="date" ></td>
</tr>
</s:iterator>
</table>
</s:if>
I am having trouble sorting the result by examining the time stamp (date/time) provided by the second column (date). The underlying action is exposing mySet, which is unsorted and the timestamp value for the second column is automatically generated for every new insert.
The objective is to simply sort the rows with the last record on top. I am not executing an explicit select statement on the database, rather than the parent entity of mySet is retrieved.
Is there a recommended way to sort this collection on the jsp (action result) level using struts2 tags and the timestamp value?
Thanks for any advice.
Kind regards
If you are using struts 2 probably you want to take a look to the display tag, with this tag your table will look something like this:
And another way of doing it is that you could probably code some javascript that sort the table on the client side.
Hope this helps.