//返回xml数据
public void responseOut() throws Exception
{
StringBuilder sb = new StringBuilder();
sb.append("<?xml version=/"1.0/" encoding=/"UTF-8/" ?>");
sb.append("<users>");
sb.append("<user id=/"50/">");
sb.append("<userName>abc</userName>");
sb.append("</user>");
sb.append("<user id=/"50/">");
sb.append("<userName>eee</userName>");
sb.append("</user>");
sb.append("</users>");
//得到response
HttpServletResponse response = ServletActionContext.getResponse();
HttpServletRequest request=ServletActionContext.getRequest();
request.setCharacterEncoding("UTF-8");
//设置编码
//response.setCharacterEncoding("UTF-8");
response.setContentType("text/xml;charset=utf-8");
response.setHeader("Cache-Control", "no-cache");
PrintWriter out = response.getWriter();
out.write(sb.toString());
out.flush();
out.close();
}