xmlhttpresult.java
来自「本源码为教学管理信息系统」· Java 代码 · 共 35 行
JAVA
35 行
/**
* 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 + =
减小字号Ctrl + -
显示快捷键?