使用ServletActionContext 获取HttpServletResponse、HttpServletRequest对象
public String execute() {
try {
HttpServletResponse httpServletResponse =ServletActionContext.getResponse();
httpServletResponse.setContentType("text/html; charset=GBK");
PrintWriter out = httpServletResponse.getWriter();
out.println("true");
out.flush();
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
public String execute() {
try {
HttpServletResponse httpServletResponse =ServletActionContext.getResponse();
httpServletResponse.setContentType("text/html; charset=GBK");
PrintWriter out = httpServletResponse.getWriter();
out.println("true");
out.flush();
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}