ajax post參數後台擷取不到的問題

來源:互聯網
上載者:User

標籤: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參數後台擷取不到的問題

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.