hwhhyh25 2008-08-21 20:09
浏览 104
已采纳

在Struts2这样结束Action的请求行吗?

这样调用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中这样配置

这样执行没有报错,不知道会不会有什么问题?请大家帮忙,分析一下,谢谢!

  • 写回答

1条回答 默认 最新

  • jolestar 2008-08-26 18:08
    关注

    意思是直接out输出,没用view是吧?
    没啥问题阿。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
  • ¥15 钢筋实图交点识别,机器视觉代码
  • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
  • ¥50 400g qsfp 光模块iphy方案
  • ¥15 两块ADC0804用proteus仿真时,出现异常