免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
AJAX和Form表單提交
AJAX提交數(shù)據(jù):

    client: 使用POST方式
        request.open("post",url,true|false);
        提交參數(shù)時(shí),中文參數(shù)要用userName = encodeURIComponent(userName)進(jìn)行編碼,
        再用send("name="+userName)發(fā)送
        
    server:
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");
        String userName = request.getParameter("name");  //正確得到中文參數(shù)
    
    
        
    client: 使用GET方式
        var url = "reg/verify?userName="+encodeURIComponent("中文"); //同樣中文要進(jìn)行編碼
        request.open("post",url,true|false);
        提交參數(shù)時(shí),中文參數(shù)要用userName = encodeURIComponent(userName)進(jìn)行編碼,
        再用send(null)發(fā)送
        
    server:
        server處理方式同F(xiàn)orm表單GET方式
        
        


Form表單提交:

    client: 使用POST方式
        <form action="reg/verify method="post">
            <input type="text" name="userName" />
            <input type="submit" value="提交"/>
        </form>
    
    server:
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");
        String userName = request.getParameter("name");  //正確得到中文參數(shù)
        
        
        
        
    client: 使用GET方式
        <form action="reg/verify method="get">
            <input type="text" name="userName" />
            <input type="submit" value="提交"/>
        </form>
    
    server:
        request.setCharacterEncoding("UTF-8");  //無(wú)論有沒(méi)有該語(yǔ)句,都要進(jìn)行重新解碼編碼
        response.setContentType("text/html;charset=UTF-8");
        userName = new String(userName.getBytes("ISO-8859-1"), "UTF-8"); //正確得到中文參數(shù)






使用<a href></a>提交方式:(不推薦使用)

    client:
        使用<a href="reg/verify?userName=寧曉進(jìn)">submit</a>提交方式,
        原理:IE8、FF等瀏覽器發(fā)送請(qǐng)求前會(huì)用encodeURIComponent(userName)進(jìn)行編碼,但有些瀏覽器不會(huì)自動(dòng)編碼,服務(wù)器接收會(huì)出錯(cuò),所以最好在發(fā)送中文等特殊字符前手動(dòng)進(jìn)行編碼。
        
    
    server:
        server處理方式同F(xiàn)orm表單GET方式
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
JSP亂碼雜談
提交表單時(shí)指定編碼
瀏覽器亂碼
java中文亂碼解決之道(八)-----解決URL中文亂碼問(wèn)題
如何解決表單提交的中文亂碼問(wèn)題
form action中g(shù)et \post傳遞參數(shù)的問(wèn)題
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服