<script type="text/javascript">
     function  innerNode(pid,url,doname){
     var pid=document.getElementById(pid);
     var li=document.createElement('li');
     var a=document.createElement('a');
     a.href=url;
     var name = document.createTextNode(doname);
    
a.appendChild(name);
a.target="right";
     li.appendChild(a);
     pid.appendChild(li);
     }
</script><s:iterator value="#session.setUtr"  id="utr" >
    <s:if test="#utr.pid!=0" >
    <script type="text/javascript" charset="UTF-8">
     window.onload= innerNode('<s:property value="pid"/>','<s:property value="url"/>','<s:property value="doname"/>');
    </script>
    </s:if>
</s:iterator>这是后台管理系统  权限模块    添加下拉菜单中的字体显示是 &#数字   怎么改编码方式都弄不成汉字 请高手解疑

解决方案 »

  1.   

    页面,处理类,各处编码都用UTF-8.
    你给的这些代码,看不出来问题.
      

  2.   

    stuts 设置编码 reponse.setE..具体方法名字忘记了utf-8 
    写在方法头上
    页面编码设置utf-8
      

  3.   

    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
    <%@taglib prefix="s" uri="/struts-tags"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
    + request.getServerName() + ":" + request.getServerPort()
    + path + "/";
    %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>左</title><script src="js/prototype.lite.js" type="text/javascript"></script>
    <script src="js/moo.fx.js" type="text/javascript"></script>
    <script src="js/moo.fx.pack.js" type="text/javascript"></script>
    <script type="text/javascript">
         function  innerNode(pid,url,doname){
         var pid=document.getElementById(pid);
         var li=document.createElement('li');
         var a=document.createElement('a');
         a.href=url;
         var name = document.createTextNode(doname);
        
    a.appendChild(name);
    a.target="right";
         li.appendChild(a);
         pid.appendChild(li);
         }
    </script>
    <style>
    body {
    font:12px Arial, Helvetica, sans-serif;
    color: #000;
    background-color: #EEF2FB;
    margin: 0px;
    }
    #container {
    width: 182px;
    }
    H1 {
    font-size: 12px;
    margin: 0px;
    width: 182px;
    cursor: pointer;
    height: 30px;
    line-height: 20px;
    }
    H1 a {
    display: block;
    width: 182px;
    color: #000;
    height: 30px;
    text-decoration: none;
    moz-outline-style: none;
    background-image: url(imagesleft/menu_bgS.gif);
    background-repeat: no-repeat;
    line-height: 30px;
    text-align: center;
    margin: 0px;
    padding: 0px;
    }
    .content{
    width: 182px;
    height: 26px;

    }
    .MM ul {
    list-style-type: none;
    margin: 0px;
    padding: 0px;
    display: block;
    }
    .MM li {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    line-height: 26px;
    color: #333333;
    list-style-type: none;
    display: block;
    text-decoration: none;
    height: 26px;
    width: 182px;
    padding-left: 0px;
    }
    .MM {
    width: 182px;
    margin: 0px;
    padding: 0px;
    left: 0px;
    top: 0px;
    right: 0px;
    bottom: 0px;
    clip: rect(0px,0px,0px,0px);
    }
    .MM a:link {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    line-height: 26px;
    color: #333333;
    background-image: url(imagesleft/menu_bg1.gif);
    background-repeat: no-repeat;
    height: 26px;
    width: 182px;
    display: block;
    text-align: center;
    margin: 0px;
    padding: 0px;
    overflow: hidden;
    text-decoration: none;
    }
    .MM a:visited {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    line-height: 26px;
    color: #333333;
    background-image: url(imagesleft/menu_bg1.gif);
    background-repeat: no-repeat;
    display: block;
    text-align: center;
    margin: 0px;
    padding: 0px;
    height: 26px;
    width: 182px;
    text-decoration: none;
    }
    .MM a:active {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    line-height: 26px;
    color: #333333;
    background-image: url(imagesleft/menu_bg1.gif);
    background-repeat: no-repeat;
    height: 26px;
    width: 182px;
    display: block;
    text-align: center;
    margin: 0px;
    padding: 0px;
    overflow: hidden;
    text-decoration: none;
    }
    .MM a:hover {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    line-height: 26px;
    font-weight: bold;
    color: #006600;
    background-image: url(imagesleft/menu_bg2.gif);
    background-repeat: no-repeat;
    text-align: center;
    display: block;
    margin: 0px;
    padding: 0px;
    height: 26px;
    width: 182px;
    text-decoration: none;
    }
    </style>
    </head><body><table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#EEF2FB">
      <tr>
        <td width="182" valign="top">
        <div id="container">
        
        <s:iterator value="#session.setUtr"  id="utr" >
         <s:if test="#utr.pid==0" >
         <h1 class="type"><a href="javascript:void(0)"><s:property value="doname"/></a></h1>
         <div class="content">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                 <td><img src="imagesleft/menu_topline.gif" width="182" height="5" /></td>
                </tr>
            </table>
            <ul class="MM" id="<s:property value="mid"/>">
            </ul>
           </div>
           </s:if>
        </s:iterator>
        
        
        <s:iterator value="#session.setUtr"  id="utr" >
        <s:if test="#utr.pid!=0" >
        <script type="text/javascript" charset="UTF-8">
         window.onload= innerNode('<s:property value="pid"/>','<s:property value="url"/>','<s:property value="doname"/>');
        </script>
        </s:if>
        </s:iterator>
       
       
    <%-- <s:iterator value="#session.setUtr"  id="utr">--%>
    <%--     <s:if test="#utr.pid!=0" >--%>
    <%--         <a href="javascript:void()"  onclick="innerNode('<s:property value="pid"/>','<s:property value="url"/>','<s:property value="doname"/>')"><s:property value="doname"/></a>--%>
    <%--     </s:if>--%>
    <%--    </s:iterator>--%>
    </div>
        </td>
      </tr>
      
    </table>
    <script type="text/javascript">
    var contents = document.getElementsByClassName('content');
    var toggles = document.getElementsByClassName('type');

    var myAccordion = new fx.Accordion(
    toggles, contents, {opacity: true, duration: 400}
    );
    myAccordion.showThisHideOpen(contents[0]);
    </script>
    </body>
    </html>
    一个权限树   有MID自己的编号   PID双亲节点