解决方案 »
- java 路径配置
- 每个页面都有相同内容,怎么处理更简便
- hibernate子查询的问题
- struts2 传值的问题
- myeclipse调试hibernate老是出现异常SQLGrammarException?怎么办?
- log4j的日志——诡异事件
- 为什么由 S:HIDDEN 引起的文本框内容不能传到 STRUTS的ACTION中
- 急呀,有高手向这里看,一个页面存入数据库的问题......
- JBOSS3.2.3启动过程中提示下面的错误!!
- 急,xml的encoding的问题?
- 使用getHibernateTemplate().find(hql, object[])出现的怪异问题
- 帮忙看看这个翻页技术!!
你是需要通过respose返回到前台去的。在resposne已经响应完了。。不能再有return的,在前台的回调函数里面 你就可以使用
var data = Ext.util.decode(response.responseText); action里面的方法应该改一下。、、 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");}
});