提交一颗树,三级区域个数大于1000个导致提交失败!!!

org.springframework.beans.InvalidPropertyException: Invalid property 'divisionList[1000]' of bean class [com.gome.bean.Presell]: Index of out of bounds in property path 'divisionList[1000]'; nested exception is java.lang.IndexOutOfBoundsException: Index: 1000, Size: 1000
org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:811)
org.springframework.beans.BeanWrapperImpl.getNestedBeanWrapper(BeanWrapperImpl.java:554)

溯源了下Spring的代码,找到了DataBinder,先解释下DataBinder类的作用,见链接 
http://docs.spring.io/spring/docs/1.2.x/api/org/springframework/validation/DataBinder.html 
其中有一句

INFO: More than the maximum number of request parameters (GET plus POST) for a single request ([10,000]) were detected. Any parameters beyond this limit have been ignored. To change this limit, set the maxParameterCount attribute on the Connector.
Note: further occurrences of this error will be logged at DEBUG level.

解决如下:重set下autoGrowCollectionLimit,当做绑定的时候set为3000或者更大 
在Controller重写这个方法

/**
* 由于Spring在接受前台传入的List时,就会出现256的IndexOutOfBoundsException异常
* 设置setAutoGrowCollectionLimit为1024
* @param binder
* @see [类、类#方法、类#成员]
*/
@InitBinder
public void initListBinder(WebDataBinder binder)
{
// 设置需要包裹的元素个数,默认为256
binder.setAutoGrowCollectionLimit(3000);
}
 

或者不用表单提交

先转换成json字符串到后台 然后用jsonarray反序列和成集合对象也是可以的

原贴  https://blog.csdn.net/zgliang88/article/details/52780213

springmvc封装list个数限制问题的更多相关文章

  1. SpringMVC封装表单数据

    1.domain类 package com.xiaostudy.domain; public class User { private int id; private String username; ...

  2. springmvc对象映射个数超过256个

    /** 由于Spring在接受前台传入的List时,就会出现256的IndexOutOfBoundsException异常 设置setAutoGrowCollectionLimit为1024 @par ...

  3. SpringMVC 封装返回结果对象

    /*** *请求返回的最外层对象 **/ public class Result<T>{ /*错误码*/ private Integer code; /*提示信息*/ private St ...

  4. springmvc 结合 自动封装异常信息输出为json 报错 500内部服务器错误的原因

    补充:还有一个原因是因为spring的对象没有被成功注入,例如 mapper没有被成功注入,抛出异常时在这种封装场景下将会抛出 500 服务器内部错误, 这种情况下要排查还是靠debug然后看看到底是 ...

  5. SpringMVC文件上传下载(单文件、多文件)

    前言 大家好,我是bigsai,今天我们学习Springmvc的文件上传下载. 文件上传和下载是互联网web应用非常重要的组成部分,它是信息交互传输的重要渠道之一.你可能经常在网页上传下载文件,你可能 ...

  6. 【转载】SpringMVC学习笔记

    转载于:SpringMVC笔记 SpringMVC 1.SpringMVC概述 MVC: Model(模型): 数据模型,提供要展示的数据,:Value Object(数据Dao) 和 服务层(行为S ...

  7. springMvc请求的跳转和传值

    forword跳转页面的三种方式: 1.使用serlvet /** * 使用forward跳转,传递基本类型参数到页面 * 注意: * 1.使用servlet原生API Request作用域 * */ ...

  8. springmvcの神总结のreadme

    ********李守宏springmvc******** 3.== --\springmvc一个controller实现多个方法 ----\继承MultiActionController ----\配 ...

  9. springmvc+swagger构建Restful风格文档

    本次和大家分享的是java方面的springmvc来构建的webapi接口+swagger文档:上篇文章分享.net的webapi用swagger来构建文档,因为有朋友问了为啥.net有docpage ...

随机推荐

  1. 3期浅析宽字节注入-----SQL注入

    通过分类的名称,你就可以找到漏洞银行的hack show视频. 吸收这个知识的几个关键的信息. 1.通过视频得到知识源.         [信息来源] 我怎么从不清楚到知道这个信息来源?这个过程没办法 ...

  2. 使用FFmpeg进行视频抽取音频,之后进行语音识别转为文字

    1.首先需要下载FFmpeg: 2.Gradle依赖 def void forceVersion(details, group, version) { if (details.requested.gr ...

  3. SQL数据库正在恢复 查看进度

    在使用SQL的过程中.. 开启一个事务..进行大计算量..在中间出错或者强制杀死SQL服务进程..总之事务没有提交.. 再次开启时sql会进入自动检查的过程.. 数据库小的话问题不大..会比较快.. ...

  4. android 用命令行打包生成 apk

    android 用 ant 进行 build. android sdk 下面的 tools/ant 下面的 build.xml 就是 build 的整个过程. 其中的 build 参数可在 ant.p ...

  5. robots 小记

    简介 网站所有者使用/robots.txt文件向网站机器人提供有关其网站的说明;这称为 Robots Exclusion Protocol.它的工作原理是这样的:robot 想要访问一个网站URL,比 ...

  6. SpringMVC的json交互

    一.注解说明 1.@RequestBody  作用:@RequestBody注解用于读取http请求的内容(字符串),通过springmvc提供的HttpMessageConverter接口将读到的内 ...

  7. NPOI excel导出快速构建

    直接上代码,这个是一个在webFrom中的例子,要请求的页面是ashx public void ExportVisaFeeAll(HttpContext context) { try { string ...

  8. MdiContainer

    /// <summary> /// 显示form /// </summary> /// <param name="form">要显示的form& ...

  9. What is the difference between modified duration, effective duration and duration?

    Macaulay Duration (traditionally just called Duration) The formula usually used to calculate a bond' ...

  10. CentOS7部署.Net Core2.0站点(中)

    继续上篇的内容,本篇来学习下nginx的配置和守护进程supervisor的使用. 一.Nginx安装及配置 (1)安装nginx sudo yum install epel-release #添加源 ...