Hi
I'm new to this. I have a Person object with a List of dogs of type Dog. I'm successfully getting the Person I want and accessing all their dogs from the List.
1. I'm using the id column as the index, and I've just realized that unless the List of dogs contains ids sequentially, starting with 0, I get an error when trying to access the List. Makes sense, fair enough. Do I really have to maintain an idx column on the table purely for this purpose, or is there a better way?
2. I've put the Person into a command object and I'm accessing it in the form like this :-
Code:
<c:forEach items="${person.dogs}" var="i" varStatus="itemsRow">
<form:input path="dogs[${itemsRow.index}].name"/><form:input path="dogs[${itemsRow.index}].type"/></br>
</c:forEach>
How do I loop through the dogs in alphabetical name order?
Many Thanks