form提交時候注意過長參數

有時候在form提交的時候常常系統以下形式:javascript

url?p1=phtml

p1=p數據很長java

例如瀏覽器

POST /dvtboss/print/operatelogprintlist/operatelog-printlist!doPrint.action?event_id=20161227007740365335;20161227007740365434;20161227007740365433;20161227007740365432;20161227007740365431;20161227007740365430;20161227007740365429;20161227007740365428;20161227007740365427;20161227007740365426;20161227007740365425;20161227007740365424;20161227007740365423;20161227007740365422;20161227007740365421;20161227007740365420;20161227007740365419;20161227007740365418;20161227007740365417;20161227007740365416;20161227007740365415;20161227007740365414;20161227007740365413;20161227007740365412;20161227007740365411;20161227007740365410;20161227007740365409;20161227007740365408;20161227007740365407;20161227007740365406;20161227007740365405;20161227007740365404;20161227007740365403;20161227007740365402;20161227007740365401;20161227007740365400;20161227007740365399;20161227007740365398;20161227007740365397;20161227007740365396;20161227007740365395;20161227007740365394;20161227007740365393;20161227007740365392;20161227007740365391;20161227007740365390;20161227007740365389;20161227007740365388;20161227007740365387;20161227007740365386;20161227007740365385;20161227007740365384;20161227007740365383;20161227007740365382;20161227007740365381;20161227007740365380;20161227007740365379;20161227007740365378;20161227007740365377;20161227007740365376;20161227007740365375;20161227007740365374;20161227007740365373;20161227007740365372;20161227007740365371;20161227007740365370;20161227007740365369;20161227007740365368;20161227007740365367;20161227007740365366;20161227007740365365;20161227007740365364;20161227007740365363;20161227007740365362;20161227007740365361;20161227007740365360;20161227007740365359;20161227007740365358;20161227007740365357;20161227007740365356;20161227007740365355;20161227007740365354;20161227007740365353;20161227007740365352;20161227007740365351;20161227007740365350;20161227007740365349;20161227007740365348;20161227007740365347;20161227007740365346;20161227007740365345;20161227007740365344;20161227007740365343;20161227007740365342;20161227007740365341;20161227007740365340;20161227007740365339;20161227007740365338;20161227007740365337;20161227007740365336&instpdofferid=undefined HTTP/1.1
Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, */*
Referer: http://127.0.0.1:8080/dvtboss/businessmanage/offer/user-offer!toCsOperatingLogPrintList.action?custNo=
Accept-Language: zh-CN
User-Agent: Mozilla/4.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3)
Accept-Encoding: gzip, deflate
Host: 127.0.0.1:8080
Connection: Keep-Alive
Cookie: JSESSIONID=4ea1nfrs54m3jc5skpbcxdnp; style=001; sdmenu_my_menu=100001000000000000000000
Content-Type: application/x-www-form-urlencoded
Content-Length: 2817
Cache-Control: no-cache

要知道Url等於url?p1=p這種形式是把他當成一個url來處理,每一個瀏覽器的URL都有限長,p1=p參數大於瀏覽器URL限長時,會出現各類問題。app

正常的處理要講參數放在form的input中,避免參數太長引發瀏覽器對URL限制錯誤ide

<s:form name="form1" id="form1" theme="simple">
	<input type="hidden" name="event_id" id="event_id" value=""/>
	<input type="hidden" name="instpdofferid" id="instpdofferid" value=""/>	
</s:form>

 

PS知識點:url

<iframe name="printframe" id="printframe" src="#" style="display: none;" width="100%" height="200"></iframe>
$('form1').action="${ctx}/print/operatelogprintlist/operatelog-printlist!doPrint.action";
$('form1').target="printframe";
$('form1').submit();

form的traget屬性在form提交是的原理是:code

將form1的form進行一次提交,如form1中的參數input會被提交,返回結果填充iframeorm

相關文章
相關標籤/搜索