5

嗨,我尝试将 bean 中的数组从 jsp 传递给 java。

@ModelAttribute("areasActividadAdminBean")AreasActividadAdminBean areasActividadAdminBean

Agrupacion[] listaAgrupaciones = x;

model.addAttribute("areasActividadAdminBean",areasActividadAdminBean);

在 JSP 中我有这个:

<form:form commandName="areasActividadAdminBean" .....>

<form:hidden path="listaAgrupaciones"/>

<input type="submit" value="Button"/>

但我得到这个错误:

org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
Field error in object 'areasActividadAdminBean' on field 'listaAgrupaciones': rejected value 
4

1 回答 1

12

确保 BindingResult 方法参数遵循您要绑定的对象。例子

public String add(@Valid DomainObject domainObj, BindingResult result, ModelMap model) {
于 2013-09-01T03:02:28.337 回答