📄 xmlhttpresult.java
字号:
/**
* Copyright (c) 2002-2005 by HeiLongJiang Oliveinfo Industry Co.,Ltd.
* All rights reserved.
*/
package com.wygl.xmlhttp;
import java.io.PrintWriter;
import javax.servlet.http.HttpServletResponse;
import com.opensymphony.webwork.ServletActionContext;
import com.opensymphony.xwork.ActionInvocation;
import com.opensymphony.xwork.Result;
import com.opensymphony.xwork.util.OgnlValueStack;
/**
* @author:xiexd
* Created on 2005-12-16
*
*/
public class XmlHttpResult implements Result {
public void execute(ActionInvocation arg0) throws Exception {
OgnlValueStack stack = (OgnlValueStack) ServletActionContext.getRequest().getAttribute("webwork.valueStack");
String xmlString = (String) stack.findValue("xmlString");
if (xmlString == null) {
throw new NullPointerException("No xmlString found");
}
HttpServletResponse response = ServletActionContext.getResponse();
response.setContentType("text/xml;charset=gbk");
PrintWriter writer = response.getWriter();
System.out.println("=======XmlHttpResult xmlString="+xmlString);
writer.write(xmlString);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -