这样调用Struts2 的Aciton: tree.loadXML("/dhtmlxTree.action?userid=<%=id%>");
在Action中这样写:
public voidjdomDhtmlxTree() throws Exception {
HttpServletResponse response = ServletActionContext.getResponse();
......
Document xmlDocument = new Document(tree);
org.jdom.output.Format format = org.jdom.output.Format.getCompactFormat();
format.setEncoding("gb2312");
format.setIndent(" ");
XMLOutputter outputter = new XMLOutputter(format);
try {
response.setContentType("text/xml; charset=gb2312");
response.setHeader("Cache-Control", "no-cache");
outputter.output(xmlDocument, response.getWriter());
}
catch (IOException e) {
e.printStackTrace();
}
}
struts.xml中这样配置
这样执行没有报错,不知道会不会有什么问题?请大家帮忙,分析一下,谢谢!