出于某种原因,我收到以下错误消息:
Developer Notification (set struts.devMode to false to disable this message): Unexpected Exception caught setting 'claimForm.payableEvents[1].totalHours' on 'class com.somedomain.application.action.claimreimbursement.ProcessSaveClaimFormAction: Error setting expression 'claimForm.payableEvents[1].totalHours' with value '[Ljava.lang.String;@54f242c1'
Developer Notification (set struts.devMode to false to disable this message): Unexpected Exception caught setting 'claimForm.payableEvents[2].totalHours' on 'class com.somedomain.application.action.claimreimbursement.ProcessSaveClaimFormAction: Error setting expression 'claimForm.payableEvents[2].totalHours' with value '[Ljava.lang.String;@1ff32b5d'
Developer Notification (set struts.devMode to false to disable this message): Unexpected Exception caught setting 'claimForm.payableEvents[1].totalHours' on 'class com.somedomain.application.action.claimreimbursement.ProcessSaveClaimFormAction: Error setting expression 'claimForm.payableEvents[1].totalHours' with value '[Ljava.lang.String;@54f242c1'
Developer Notification (set struts.devMode to false to disable this message): Unexpected Exception caught setting 'claimForm.payableEvents[2].totalHours' on 'class com.somedomain.application.action.claimreimbursement.ProcessSaveClaimFormAction: Error setting expression 'claimForm.payableEvents[2].totalHours' with value '[Ljava.lang.String;@1ff32b5d'
根据关于缺失参数的警告标题下Parameters Interceptor的文章,我的理解是参数的设定者存在问题。
我已经回去检查了,我确实有一个为参数命名的setter。
以下是我的java类的精简版:
public class ClaimWizardPayableEventAjaxAction{
private ClaimForm claimForm;
public void setClaimForm(ClaimForm claimForm) {
this.claimForm = claimForm;
}
}
public class ClaimForm{
private List<PayableEvent> payableEvents;
public void setPayableEvents(List<PayableEvent> payableEvents) {
this.payableEvents = payableEvents;
}
}
public class PayableEvent{
private BigDecimal totalHours;
public void setTotalHours(BigDecimal totalHours) {
this.totalHours = totalHours;
}
}
我的jsp使用c:forEach:
<input type="text" class="input-small" name="claimForm.payableEvents[${i.index}].totalHours" />
至于我试过的是什么?我看了我的拼写,没有看到任何不一致的地方。我已经检查过它确实保存了价值。这是否与它被投射到一个大BigDecimal
?
答案 0 :(得分:0)
这是由于类型转换,因为您没有使用Struts标记,该值将转换为字符串并返回BigInteger
。如果您不想收到此类警告,可以关闭struts.devMode
。