Hello, I'm creating a loop with a list of dates for presentation inside a
form. When I submit the form, it fails with the following exception.
org.apache.tapestry5.ioc.util.UnknownValueException
*Could not find a coercion from type java.lang.String to type
java.util.Date.*
availableValues
Configured coercions:
I'm using the following code.
<t:Loop source="workDates" value="workDate">
<div class="col-xs-15"><div><t:output format="literal:MM-dd"
value="workDate"/></div></div>
</t:Loop>
@Property
private List<Date> workDates;
@Property
private Date workDate;
Object onActivate(TimeSheetEntity timeSheetEntity) throws Exception {
workDates = getWorkDates(timeSheetEntity)
}
public List<Date> getWorkDates(TimeSheetEntity timeSheetEntity) {
List<Date> workDates = new ArrayList<>();
for (int i = -13; i <= 0; i++) {
Calendar cal = Calendar.getInstance();
cal.setTime(timeSheetEntity.getEndDate());
cal.add(Calendar.DAY_OF_MONTH, i);
workDates.add(cal.getTime());
}
return workDates;
}
--
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York