標籤:tom ges content for handle max not 官方 form
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”,問題就得到瞭解決
ajax post參數後台擷取不到的問題