公司项目用到了AjaxAnyWhere 和Struts
现在碰到这么一个问题..在Struts里面向客户端返回数据
我重写了aa.js里面的callback 回调函数....
但用responseText 接收返回信息时总是为空! 这是什么原因啊!struts :
public class ListAction extends Action { public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception {
PrintWriter out=null;
out=response.getWriter();
if(AAUtils.isAjaxRequest(request)){
AAUtils.addZonesToRefresh(request, "list");
}
System.out.println("name:"+request.getParameter("name"));
System.out.println"address:"+request.getParameter"address"));
out.print("yumensile");
out.close();
return null;
}
}
aa.js AjaxAnywhere.prototype.callback = function() { if (this.req.readyState == 4) {
this.callbackExecuted = true; this.onBeforeResponseProcessing();
this.hideLoadingMessage(); if (this.req.status == 200) { if (this.req.getResponseHeader('content-type').toLowerCase().substring(0, 8) != 'text/xml') {
this.handleWrongContentType();
return;
}
alert(this.req.responseText);
}
}
}
现在碰到这么一个问题..在Struts里面向客户端返回数据
我重写了aa.js里面的callback 回调函数....
但用responseText 接收返回信息时总是为空! 这是什么原因啊!struts :
public class ListAction extends Action { public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception {
PrintWriter out=null;
out=response.getWriter();
if(AAUtils.isAjaxRequest(request)){
AAUtils.addZonesToRefresh(request, "list");
}
System.out.println("name:"+request.getParameter("name"));
System.out.println"address:"+request.getParameter"address"));
out.print("yumensile");
out.close();
return null;
}
}
aa.js AjaxAnywhere.prototype.callback = function() { if (this.req.readyState == 4) {
this.callbackExecuted = true; this.onBeforeResponseProcessing();
this.hideLoadingMessage(); if (this.req.status == 200) { if (this.req.getResponseHeader('content-type').toLowerCase().substring(0, 8) != 'text/xml') {
this.handleWrongContentType();
return;
}
alert(this.req.responseText);
}
}
}
极度期待中啊.....