Problems with data loss from form submission

Source: Internet
Author: User

During the process approval process, when the approval was submitted, discovery was made using Request.getparameter ("TaskId") to obtain the data and found that the task ID was empty.

During debugging I found that the amount of data in the form was particularly large.

To the online query, said that the number of post data data is limited.

So I wrote a form and tested it:

<%@ Page Language="Java"ContentType="text/html; Charset=utf-8"pageencoding="Utf-8"%><%    StringtaskId=Request.getparameter ("taskId"); Stringname=Request.getparameter ("name");        System.out.println (TASKID); SYSTEM.OUT.PRINTLN (name);%><!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd "><HTML><Body><formname= "Frmsubmit"Method= "POST"><inputtype= "text"name= "TaskId"><textarearows= "+"cols= "$"name= "Name"></textarea><inputtype= "Submit"value= "Submit"></form></Body></HTML>

The test result is that the data is not available if the data exceeds 2MB. Is two forms are not getting data, then modify the Tomcat connection parameters.

< Connector    maxpostsize = "0" uriencoding = "Utf-8" ConnectionTimeout = "20000"   port= "8080"  protocol= "http/1.1"  redirectport= " 8443 "/>

Changing the maxpostsize to 0 does not show the post data size.

Found that there is still no solution to the previous problem.

During debugging, the server prints the following information.

Info: More than the maximum number of request parameters (GET plus POST) for a single request ([up]) were detected. Any parameters beyond this limit has been ignored. To change this limit, set the Maxparametercount attribute on the Connector.

Searched for this alarm message.

It turns out that the server has limited the parameters of the submission, and the Tomcat document describes the following:

The maximum number of parameters (GET plus POST) which'll be automatically parsed by the container. A value of less than 0 means no limit. If not specified, a default of 10000 is used. Note that Failedrequestfilter filter can is used to reject requests the limit.

This default value is 10,000, if more than 10,000, then discard. This also explains why the data can be obtained when I advance the taskid to the form tag.

Know the reason:

We modified the Tomcat configuration as follows:

<maxparametercount= "-1"  maxpostsize= "0"  uriencoding= "Utf-8"  connectiontimeout= "20000"  port= "8080 "  protocol=" http/1.1 "  redirectport=" 8443 "/>

No limit to the size of the parameter and submit data, so re-approval is no problem.

Of course, this solution is not very good, because he will greatly consume server performance, because the parameters submitted more than 10,000.

The solution is not to submit such a form, which we can in this form system.

Because there is no need to submit so many parameters, our data is assembled into a JSON to commit, which will greatly improve the performance of the server.

Change our program to use Ajaxpost to submit, just submit some parameters.

Problems with data loss from form submission

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.