Hi GameOne,
Not sure if I completely understand your question, but if an object can have multiple values and you want to display them, I would think you would want some Collection object (probably either a List or a Set) reference in the object. For example, assuming that a Person can have multiple Countries:
Code:
public class Person {
private Set<Country> countries;
public Set<Country> getCountries() {
return this.countries;
}
public void setCountries(Set<Country> countries) {
this.countries = countries;
}
}
Then in your view page, iterate over the Collection. The following code is taken from the PetClinic sample application's war/WEB-INF/jsp/visitForm.jsp file:
Code:
<B>Previous Visits:</B>
<TABLE border="true">
<TH>Date</TH><TH>Description</TH>
<c:forEach var="visit" items="${visit.pet.visits}">
<c:if test="${!visit.new}">
<TR>
<TD><fmt:formatDate value="${visit.date}" pattern="yyyy-MM-dd"/></TD>
<TD><c:out value="${visit.description}"/></TD>
</TR>
</c:if>
</c:forEach>
</TABLE>
In the above case, the view is iterating over a pet's Set of Visits.
So by having a Set of Country objects in a Person, you can then iterate over the Countries in your view via: person.countries. There are other issues, such as how to provide the Person object to the view for outputting, but that is a different story.
If this did not answer your question, please re-post.
-Arthur Loder