zoukankan      html  css  js  c++  java
  • tomcat7以上,ajax post参数后台获取不到的问题

    AJAX post传参后台获取不到查询参数。

    网上找了各种方法,包括设置content-type,又是把json转成json格式字符串,问题依然存在,但是把post改成get又可以获取到,百思不得其解。

    后来看tomcat7配置的时候,把maxPostSize="0"的配置去掉的时候问题消失。

    根据以往的经验,maxPostSize="0"不就是不限制post数据的大小的么,怎么还反倒限制了数据的大小了呢?

    因为项目里面要post一个数据到后台保存(大小可能大于2M),所以这大小就不能限制。

    再后来在tomcat的官方文档里发现了这个maxPostSize的变动。

    tomcat6.0的文档里说maxPostSize不限制的设置是小于等于0

    原话:The maximum size in bytes of the POST which will be handled by the container FORM URL parameter parsing. The feature can be disabled by setting this attribute to a value less than or equal to 0. If not specified, this attribute is set to 2097152 (2 megabytes).

    tomcat7.0的文档里面说maxPostSize不限制的设置是小于0

    原话:The maximum size in bytes of the POST which will be handled by the container FORM URL parameter parsing. The limit can be disabled by setting this attribute to a value less than zero. If not specified, this attribute is set to 2097152 (2 megabytes). Note that theFailedRequestFilter can be used to reject requests that exceed this limit.

    所以把maxPostSize设置成“-1”,问题就得到了解决

  • 相关阅读:
    HashMap与ArrayList的相互嵌套
    Mysql与Oracle 的对比
    什么是子查询
    创建存储过程
    cmd 快捷键
    navicat 快捷键
    Mysql的数据类型 6种
    Mysql与Oracle 的使用区别
    怎样修复ie浏览器
    Linux官方内置Bash中新发现一个非常严重安全漏洞
  • 原文地址:https://www.cnblogs.com/luoruiyuan/p/6518524.html
Copyright © 2011-2022 走看看