JSP + Iteration Output

59 Views Asked by At

I'm trying to iterate through a list of Birthdate objects. Inside this object there are 2 variables. A Date object for the birthdate itself and a String for a partially masked date (ie. --/--/2015)

The When portion is working fine and displaying the date properly but when testing out the Otherwise portion I get the following error:

java.lang.IllegalArgumentException: Cannot convert --/--/1956 of type class java.lang.String to class java.util.Date

Am I just missing something totally obvious here? From the examples I've found this should be possible. Below is my code:

<c:choose>   
 <c:when test="${person.showBirthDates}"> 
    <c:forEach var="bdate" items="${person.birthdates}" varStatus="status">
    <fmt:formatDate value="${bdate.birthdate}" pattern="MM/dd/yyyy"/>
    </td> </tr>
    <tr><td></td><td>
    </c:forEach>
</c:when>
<c:otherwise>
    <c:forEach var="bdate" items="${person.birthdates}" varStatus="status">
    <c:out value= "${bdate.birthdateMask}" />
    </td> </tr>
    <tr><td></td><td>
    </c:forEach>
</c:otherwise>
</c:choose>
0

There are 0 best solutions below