`
talentluke
  • 浏览: 593474 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

PA_Login_Portlet_App.ear的LoginView.jsp乱码

阅读更多

LoginView.jsp文件的头部一定要加上编码

<%@ page language="java" contentType="text/html" pageEncoding="UTF-8" session="false"%>

 

 

<%@ include file="./StatusMessageInclude.jspf"%>
   

   <script type="text/javascript">

     function toUnicode(str)
     {
      var unicodeStr = escape(str);
      unicodeStr = unicodeStr.replace(/%/g, "\\");
      //cannot do like this, must reassign new value
      //unicodeStr.replace(/%/g, "\\");

      return unicodeStr;
     }
     function unUnicode(unicodeStr)
     {
      var str = unicodeStr.replace(/\\/g, "%");
      str = unescape(str);

      return str;
     }


     var isSuccess = <%=isLoginSuccessful %>;
     var msg = "<%=message %>";

     if ((!isSuccess) && ("null" != msg))
     {
      //does work
      msg = encodeURI("很抱歉,你的用户名或者密码错误!");
      msg = decodeURI(msg);
                 
      //does work too!
      msg = escape("很抱歉,你的用户名或者密码错误!");
      msg = unescape(msg);
                 
      //does work!
      /*msg = unescape("\u5F88\u62B1\u6B49\uFF0C\u4F60\u7684\u7528\u6237\u540D\u6216\u8005\u5BC6\u7801\u8F93\u5165\u9519\u8BEF\uFF01");*/

                    //does work!
       /*msg = toUnicode("很抱歉,你的用户名或者密码错误!");
       msg = unUnicode(msg);*/

      //alert(msg);   
     }

    //-->
   </script>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics