Java POST 请求 为null

Form表单提交,POST请求,后端request(request.getParameter)里接收不到任何参数如何解决:

1.检查form表单的contentType是否为  x-www-form-urlencoded 方式,不是前端做一下限制即可;

2. 注意服务器maxPostSize的配置,这个参数会对提交的post请求大小有一定的限制。

tomcat:默认大小2097152,当maxPostSize<=0时,不限制;maxPostSize=20971520时,为20M
nginx:默认的最大请求body大小为8m,修改设置client_max_body_size=100m;
resin:没有发现默认限制请求大小的地方!

tomcat:maxPostSize


注意:

tomcat7.0.63之前:
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).
设置为0和负数均可以代表不限制


tomcat7.0.63(包含)之后:
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 zero. If not specified, this attribute is set to 2097152 (2 megabytes).
不可以设置为0,只能是负数代表不限制

你可能感兴趣的:(post请求获取不到值,java笔记,服务器)