设为首页 加入收藏

TOP

AJAX向Response留中输出Xml的办法
2014-11-19 02:34:59 来源: 作者: 【 】 浏览:16
Tags:AJAX Response 输出 Xml 办法

  public static void outPrint(Document doc, HttpServletResponse response) throws IOException {


  response.setCharacterEncoding("UTF-8");


  response.setContentType("text/xml; charset=utf-8");


  PrintWriter out = response.getWriter();


  OutputFormat format = OutputFormat.createCompactFormat();


  //去掉xml头


  //format.setSuppressDeclaration(true);


  //format.isPadText();


  format.setEncoding("utf-8");


  XMLWriter writer = new XMLWriter(out, format);


  writer.write(doc);


  writer.flush();


  writer.close();


  }


  编辑特别推荐:


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇java程序调用命令行 下一篇JSP网站登录记忆跳转实现的一种方..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: