// 载入该用户下的菜单
@SuppressWarnings("unchecked")
public void loadMenuByUserId(){
List> menuList = (List>)daoUtil.getDaoHelper()
.queryForList("tm.menu.selectMenuByUserId",TMUtil.getUser().getUserId());
System.out.println("menuList:"+menuList.toString());
System.out.println("menuListJson:"+JSONArray.fromObject(menuList).toString());
ServletUtil.sendAsJson(response,JSONArray.fromObject(menuList).toString());
}
在控制台可以输出menuList:[{ord=1, pid=0, id=1, text=功能菜单, url=null}, {ord=1, pid=1, id=2, text=系统管理, url=null}, {ord=1, pid=2, id=3, text=菜单管理, url=MenuAction!toMenuMain.action}, {ord=3, pid=2, id=5, text=用户管理, url=UserAction!toUserMain.action}, {ord=2, pid=2, id=4, text=角色管理, url=RoleAction!toRoleMain.action}]
但JSONArray.fromObject(menuList).toString()却执行不了,在控制台输出不了,所以后面的ServletUtil.sendAsJson函数也不能将其写到前台页面。
debug时显示the source attachment does not contain the source for the JSONArray.class。急求大神帮忙啊!!!