日期:2014-05-16  浏览次数:20615 次

dwr---调用返回list的方法------取属性问题?
java方法:
public List queryFunctionsByRole( Integer roleId) {
List list = null;
final Integer roleIdTemp = roleId;
final String sql = "select * from functionInfo where function_id in ( select function_id from role_func where role_id =:role_id )";
list=this.getHibernateTemplate().executeFind(new HibernateCallback() {
@Override
public Object doInHibernate(Session session) throws HibernateException,
SQLException {
List list = session.createSQLQuery(sql).setInteger("role_id", roleIdTemp).list();
return list;
}
});
return list;
}
}



js代码:
function check(id){
RoleService.queryFunctionsByRole(id,function checkBox(data){
for(var i=0;i<data.length;i++){
alert(data[i]);
alert(data[i].function_id);

}  
);
}

java实体类:
private Integer function_id;
public Integer getFunction_id() {
return function_id;
}
public void setFunction_id(Integer function_id) {
this.function_id = function_id;
}



------解决方案--------------------
确定有function_id这个属性?
------解决方案--------------------
data[i]这对象能弹出来?有function_id这个属性?
那不可能有问题呀,
你仔细看看,
------解决方案--------------------
data[i]输出来是什么值。。
------解决方案--------------------
<convert match="java实体类 类路径" converter="bean" />