gpt4 book ai didi

java - 错误 MVC org.springframework.validation.BeanPropertyBindingResult : 1 errors with array

转载 作者:搜寻专家 更新时间:2023-11-01 01:22:15 24 4
gpt4 key购买 nike

您好,我尝试将 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

最佳答案

确保 BindingResult 方法参数跟在您要绑定(bind)到的对象之后。示例

public String add(@Valid DomainObject domainObj, BindingResult result, ModelMap model) {

关于java - 错误 MVC org.springframework.validation.BeanPropertyBindingResult : 1 errors with array,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15567037/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com