亚洲最大看欧美片,亚洲图揄拍自拍另类图片,欧美精品v国产精品v呦,日本在线精品视频免费

  • 站長資訊網(wǎng)
    最全最豐富的資訊網(wǎng)站

    javascript中string亂碼怎么辦

    解決方法為:1、找到request和response對象,添加“setCharacterEncoding=UTF-8”即可;2、找到tomcat配置文件server.xml,添加“URIEncoding="utf-8"”即可。

    javascript中string亂碼怎么辦

    本教程操作環(huán)境:windows7系統(tǒng)、javascript1.8.5版、Dell G3電腦。

    1.對象 request response 對象setCharacterEncoding=UTF-8

     <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"  %>  <%      //解決post/get 請求中文亂碼的方法      request.setCharacterEncoding("UTF-8");      response.setCharacterEncoding("UTF-8");   %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>代碼段標簽</title> </head> <body> <%!     int name;     int password;  %>  <%      String name=request.getParameter("username");      String password =request.getParameter("pwd");      out.println("hello "+name+" success! "+"<br/>");      out.println("密碼泄露  "+password);   %> </body>

    2. 方法二 (比較簡單)

    找到tomcat 配置文件 server.xml ,加入code:URIEncoding="utf-8"

    <Connector port="8080" protocol="HTTP/1.1"                 connectionTimeout="20000"                 URIEncoding="utf-8"                                redirectPort="8443" /> <!-- URIEncoding="utf-8"  解決get/post 請求 中文亂碼 -->

    【推薦學習:javascript高級教程】

    贊(0)
    分享到: 更多 (0)
    網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號