I have a Vector of location, which has country, state and city all as Strings. I want to display the data as: USA | texas | austin, dallas, houston... USA | californa | la, san francisco ...
What I have:
<c:forEach items="${locations}" var="location" >
<h4><c:out value="${location.country.name}"/></h4>
<h4><c:out value="${location.state.name}"/></h4>
<h4><c:out value="${location.city.name}"/></h4>
</c:forEach>
What is the best way to skip country and state name if they are same as the last value. I am sure I can use local variables for currentCountry and currentState to not show duplicate values. I just want to know the best practice.
Thanks,