你这样取xml好像用不到样式表。去掉看看不行再看看 bookxsl.xsl 里的中文标识是不是和 xml了的中文标识一致,
不行你在 html 里加上中文标识看看

解决方案 »

  1.   

    这样实现肯定不是对的,每刷新一次就增加(我也搞不清楚是什么原因)和系统原来的一致
    StringBuffer bookInfo=new StringBuffer();
      try{//实例化一个SAXBuilder类来操作xml文档
         SAXBuilder sb=new SAXBuilder();
         //从文件构造一个Document
          Document doc=sb.build(new FileInputStream(filepath));
          root = doc.getRootElement();
          books=root.getChildren();
         for(int i=0;i<books.size();i++){
          book=(Element)books.get(i);//
          bookInfo.append("<tr>");
          bookInfo.append("<td>"+book.getChild("bookname").getTextTrim()+"</td>");
            bookInfo.append("<td>"+book.getChild("author").getTextTrim()+"</td>");
            bookInfo.append("<td>"+book.getChild("addtime").getTextTrim()+"</td>");
            bookInfo.append("<td>"+book.getChild("price").getTextTrim()+"</td>");
            bookInfo.append("</tr>");
            }   }catch(Exception e){
        out.println(e);
           }
    %>
    <html>
    <head>
    </head><body><table  align="center" width="394" border="1" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr align="center">
        <td height="21" colspan="3" valign="top"><div align="center">图书列表</div></td>
      </tr>
      <tr align="center">
        <td width="125" height="24" valign="top"><div align="center">书名     </div></td>
        <td width="157" valign="top"><div align="center">作者</div></td>
        <td width="112" valign="top"><div align="center">添加日期</div></td>
        <td width="112" valign="top"><div align="center">价格</div></td>
      </tr>
      <%bookInfo%>还是不对
      

  2.   

    关键是StringBuffer转String 的中文问题????