//action 中
HttpServletResponse response = ServletActionContext.getResponse();
response.setContentType("text/plain;charset=UTF-8");
try {
response.getWriter().write("Hello");
} catch (IOException e) {
e.printStackTrace();
}
return null;
ajax:
$.ajax({
type: "POST",
url: "请求action路径",
data: "提交参数",
success: function(data){
alert(data);//返回数据date
}
});
页面弹出“Hello”