Solve the problem that the received parameter is empty because the parameter is too long in Ajax submission

Time:2020-11-14

Problem description

A function of the program uses Ajax to submit parameters. Today, it is found that all the parameters received by the back-end program are empty. After checking, it is found that the length of one parameter in the submitted parameter is too long, and all the parameters received by the back-end are all empty.

Solution

Modify Tomcat’s configuration file server.xml , add the maxpostsize property to the connector tag to set the maximum length of the receiving parameter.

<Connector port="8080" protocol="HTTP/1.1"
       connectionTimeout="20000"
       redirectPort="8443"
       URIEncoding="UTF-8"
       maxPostSize="0" />

When maxpostsize is set to 0, there is no maximum limit!

be careful

Versions 7.0.63 (inclusive) and later should be set to – 1
The installation version of tomact6 also uses – 1, other versions are not tested