提交一颗树,三级区域个数大于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. 怎么使用Vue-cli3开发像iview、element那样的组件可下载直接使用

    https://www.cnblogs.com/wisewrong/archive/2018/12/28/10186611.html 参考这个就行. 而我这篇文章主要是对里面的相关步骤作一些简单的说明 ...

  2. JeeSite功能模块解读,功能介绍,功能实现

    做为十分优秀的开源框架,JeeSite拥有着很多实用性的东西. 首先说下他的一个流程 Jeesite流程 流程 主要是jsp,entity,dao,dao.xml,service,controller ...

  3. BZOJ 2457 双端队列

           Sherry 现在碰到了一个棘手的问题,有N个整数需要排序.        Sherry 手头能用的工具就是若干个双端队列.        她需要依次处理这 N 个数,对于每个数, Sh ...

  4. 3. Javascript学习笔记——变量、内存、作用域

    3. 变量.内存.作用域 3.1 基本类型和引用类型的值 ECMAScript 变量可能包含两种不同数据类型的值:基本类型值[Undefined.Null.Boolean.Number 和 Strin ...

  5. RSAUtils非对称加密

    import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.bouncycastle.util.encoders.Bas ...

  6. TP5.1 查看具体版本

    https://blog.csdn.net/haibo0668/article/details/80865785 echo \think\facade\App::version(); composer ...

  7. adb的常用命令及如何查看被占用的端口

    adb是什么?:adb的全称为Android Debug Bridge,就是起到调试桥的作用.通过adb我们可以在Eclipse中方面通过DDMS来调试Android程序,说白了就是debug工具.a ...

  8. centsos 查看系统版本信息

    [root@hostuser gitlab]# lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cx ...

  9. .Net C# 泛型序列化和反序列化JavaScriptSerializer

    项目添加引用System.Web.Extensions /// <summary> /// 泛型序列化 /// </summary> public class JsonHelp ...

  10. python excel读写数据

    python 读取excel内容,包含表格日期处理 # -*- coding: utf- -*- import xlrd #读取excel表格 workbook=xlrd.open_workbook( ...