Hello, I have a form with a gazillion fields on it that all increment with a numeric. example
timesheet.tsHours01 timesheet.tsHours02 etc I'd like to dynamically loop this, but have failed to fully get it working. What I've tried thus far. <div><t:textfield t:id="empId" value="timeSheetEntity.empId"/> <t:Loop source="tsWhours" value="tsWhour" > <div class="col-xs-15"><div><t:textfield t:id="tsWhour2" id="${tsWhour.id}" value="tsWhour.property"/></div></div> </t:Loop> @Property private List<TimeSheetEntity> timeSheetEntity; @Property private List<TsWhour> tsWhours; @Property private TsWhour tsWhour; public void onPrepareFromForm() { this.timeSheetEntity = timeSheetService.getCreateOrUpdate(timeSheetEntity); tsWhours = new ArrayList<TsWhour>(); tsWhours.add(new TsWhour(timeSheetEntity, "TsWhours01")); tsWhours.add(new TsWhour(timeSheetEntity, "TsWhours02")); tsWhours.add(new TsWhour(timeSheetEntity, "TsWhours03")); } public class TsWhour { private TimeSheetEntity timeSheetEntity; private String id; private BigDecimal property; public TsWhour() { } public TsWhour(TimeSheetEntity timeSheetEntity, String id) { this.timeSheetEntity = timeSheetEntity; this.id = id; } public BigDecimal getProperty() { try { Method method = TimeSheetEntity.class.getMethod("get" + id); return (BigDecimal) method.invoke(timeSheetEntity); } catch (NoSuchMethodException ex) { Logger.getLogger(TimeSheet.class.getName()).log(Level.SEVERE, null, ex); } catch (SecurityException ex) { Logger.getLogger(TimeSheet.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { Logger.getLogger(TimeSheet.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalArgumentException ex) { Logger.getLogger(TimeSheet.class.getName()).log(Level.SEVERE, null, ex); } catch (InvocationTargetException ex) { Logger.getLogger(TimeSheet.class.getName()).log(Level.SEVERE, null, ex); } return null; } public void setProperty(BigDecimal value) { System.out.println(value); } public TimeSheetEntity getTimeSheetEntity() { return timeSheetEntity; } public void setTimeSheetEntity(TimeSheetEntity timeSheetEntity) { this.timeSheetEntity = timeSheetEntity; } public String getId() { return id; } public void setId(String id) { this.id = id; } } I'm able to get the page to load, but when I save it fails. If possible, I would rather not specify the datatype as a bigdecimal to keep it completely dynamic. -- George Christman www.CarDaddy.com P.O. Box 735 Johnstown, New York