欧美亚洲中文,在线国自产视频,欧洲一区在线观看视频,亚洲综合中文字幕在线观看

      1. <dfn id="rfwes"></dfn>
          <object id="rfwes"></object>
        1. 站長資訊網(wǎng)
          最全最豐富的資訊網(wǎng)站

          javascript中string亂碼怎么辦

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

          javascript中string亂碼怎么辦

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

          1.對(duì)象 request response 對(duì)象setCharacterEncoding=UTF-8

           <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"  %>  <%      //解決post/get 請(qǐng)求中文亂碼的方法      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>代碼段標(biāo)簽</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 請(qǐng)求 中文亂碼 -->

          【推薦學(xué)習(xí):javascript高級(jí)教程】

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