Post大文本的情况下,request.getParameter("fieldName") returns NULL的问题
2015-04-07 21:36
573 查看
一个小问题,捣鼓了2天,整个人都崩溃了。尤其是改了半天最后发现仅仅是一个简单的参数配置。。
我的需求是,通过ajax上传比较大的文本。之前程序在小文本环境下一切ok,换成大文本(4~5M)的时候,java的request.getParameter("fieldName")得到的都是null。十分不解,后来发现居然是Tomcat的配置问题,具体如下,修改后一切正常 2333333
根据官方文档http://tomcat.apache.org/tomcat-6.0-doc/config/http.html,我们可以看出,tomcat6在默认状态下最大的post请求是2M
maxPostSize
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 or equal to 0. If not specified, this attribute is set to 2097152 (2 megabytes).
如果需要修改的,就需要找到server.xml文件
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" maxPostSize="0" />
maxPostSize: 0 表示不限制
其中单位为:byte
我的需求是,通过ajax上传比较大的文本。之前程序在小文本环境下一切ok,换成大文本(4~5M)的时候,java的request.getParameter("fieldName")得到的都是null。十分不解,后来发现居然是Tomcat的配置问题,具体如下,修改后一切正常 2333333
根据官方文档http://tomcat.apache.org/tomcat-6.0-doc/config/http.html,我们可以看出,tomcat6在默认状态下最大的post请求是2M
maxPostSize
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 or equal to 0. If not specified, this attribute is set to 2097152 (2 megabytes).
如果需要修改的,就需要找到server.xml文件
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" maxPostSize="0" />
maxPostSize: 0 表示不限制
其中单位为:byte
相关文章推荐
- SpringMVC中使用Ajax POST请求以json格式传递参数服务端通过request.getParameter("name")无法获取参数值问题分析
- SpringMVC中使用Ajax POST请求以json格式传递参数服务端通过request.getParameter("name")无法获取参数值问题分析
- struts中post方式上传文件,enctype="multipart/form-data",request.getParameter("file") 是null的问题分析
- 问题解决: Attribute value request.getParameter("id") is quoted with " which must be escaped when used wi
- 问题解决: Attribute value request.getParameter("id") is quoted with " which must be escaped when used within the value
- 解决var url="xxx&参数名="+“中文参数”; 传到后台根据String x = request.getParameter("中文参数名");乱码问题
- struts中enctype="multipart/form-data",request.getParameter("file") 是null的问题分
- FORM的ENCTYPE="multipart/form-data" 时request.getParameter()值为null问题的解决
- Attribute value request.getParameter("name") is quoted with " which must be escaped when used
- FORM的ENCTYPE="multipart/form-data" 时request.getParameter()值为null问题的解决
- FORM的ENCTYPE="multipart/form-data" 时request.getParameter()值为null问题的解决
- request.getParameter("")的返回值问题
- String baseprice = request.getParameter("baseprice")==null相关问题
- 过滤器中处理multipart/form-data头部的post请求request.getParameter(")获取不到参数问题
- Stupid error work with actionRequest.getParameter("something")
- 解决当FORM的ENCTYPE="multipart/form-data" 时request.getParameter()获取不到值的方法
- jsp js 函数 传参 只接受<%=request.getAttribute("name")%> 形式
- 在判断Request .QueryString [\"name\"]是否为空时应注意的问题
- FORM的ENCTYPE="multipart/form-data" 时request.getParameter()值为null问题的解决
- 解决当FORM的ENCTYPE="multipart/form-data" 时request.getParameter()获取不到值的方法 ?