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>

你可能感兴趣的:(portlet)