67,513
社区成员
发帖
与我相关
我的任务
分享
public void getListInfo() //返回void类型
{
DBUtils db=new DBUtils();
Result res=new Result();
res.setPerList(db.getList());
JSONArray josn=JSONArray.fromObject(res);
result=josn.toString().substring(1,(josn.toString().length()-1));
// return SUCCESS; //不需要在return 直接
HttpResponse response = SevletActionContext.getResponse();
response.getWrite().print(result); //这样子输出到前台,不然你就算去前台取值也取值不到。
response.getWrite().print(true);
}
//如果是要有页面跳转,应该是另外再用个一个action请求跳转的。
public String forward(){
return "success";
}
}
//Extjs页面 就可以取值了。。
Ext.Ajax.request({
url:url,
method:method,
params:{name:param},
success:function (response,options)
{
//这里想取得那个返回过来的值怎么取?
alert(response.responseText); //这样子取到的就是你的Json格式的数据
var data = new Ext.util.JSON.decode(response.responseText);
},
failure:function (response,options){alert("failure");}
});