iOS 使用form表單形式提交post請求

weixin_34248705發表於2018-05-03

今天朋友剛到新公司遇到個問題,後臺只支援form表單形式提交post資料,糾結了很久不知道改怎麼搞,後臺提供了一份樣例。

Exception {

String wsFormInfo = ZqkjCore.createLinkString(saveContractInfo);

String wsSignVal=DecryptData.sign(wsFormInfo,privateKey,"utf8");

StringBuffer sbHtml = new StringBuffer();

sbHtml.append("\<form id=\"zqwssubmit\" name=\"zqwssubmit\" action=\"" + netURL 

+ "\"method='post'>");

for (Map.Entry<String String> entry : saveContractInfo.entrySet()) {

      sbHtml.append("<input type=\"hidden\" name="' + entry.getKey() + "'value=\"' + entry.getValue() + "\"/>");

}

sbHtml.append("<input type=\"hidden\" name='sign_val' value=\"" + wsSignVal + "\"/>");

sbHtml.append("<input type=\"submit\" value='確認' style=\"display:none;\"></form>");

sbHtml.append("<script>document.forms['zqwssubmit'].submit();</script>");

return sbHtml.toString();

}


8903285-0f2ce4a4250b5e23.png
表單提交


html標籤會被吞,截圖如上。

相關文章