datagird不显示信息求帮助

datagird不显示信息求帮助

问题描述:

 没怎么用过easyui所以打算动手做个demo,但做了好久还是没有展示出数据来,数据是已经转换成json格式了,在控制台也答应出来了
有经验的朋友帮忙看看是什么问题
先贴上代码

<script type="text/javascript">
 $(function(){
 $("#dg").datagrid({
  url:"findall",
  width:700,
  height:350,
  rownumbers:true,
  pagination:true,//显示底部分页栏
pageSize:5,//默认每页记录数,pagination参数为true时才有效
pageList:[5,10,15], //显示列表记录数的下拉框选项,pagination参数为true时才有效
fitColumns:true,//自适应宽度,防止水平滚动
  resizable:true,
  sortable:true,
  nowrap:true,
  autoRowHeight:false,
columns:[
[
{field:'questionid',title:'id',hidden:'true'},
{field:'questioncontent',title:'题目' ,width:100,algin:'center'},
{field:'answera',title:'选项一' ,width:100,algin:'center'},
{field:'answerb',title:'选项二',width:100,algin:'center'},
{field:'answerc',title:'选项三' ,width:100,algin:'center'},
{field:'answerd',title:'选项四' ,width:100,algin:'center'},
{field:'subjectname',title:'科目',width:100,algin:'center' },
{field:'answer',title:'答案',width:100,algin:'center' }
]
]
});
}); 

</script>


struts配置文件
<package name="default" namespace="/" extends="json-default">

<action name="findall" class="action.QuestionAction" method="getAllInfo">
<result name="success" type="json">
<param name="root">result</param>
</result>
</action>
</package>


action控制层
private QuestionBiz questionBiz;
private JSONObject result=null;
Map<String, Object> map=new HashMap<String, Object>();
public QuestionBiz getQuestionBiz() {
return questionBiz;
}

public void setQuestionBiz(QuestionBiz questionBiz) {
this.questionBiz = questionBiz;
}

public String getAllInfo(){
String page = getParameter("page");
String rows = getParameter("rows");
int pages=Integer.parseInt((page==null||page=="0") ? "1" : page);
int rowss=Integer.parseInt((page==null||page=="0") ? "5" : rows);
List<Question> list=new ArrayList<Question>();
list=questionBiz.getAllInfo(pages, rowss);
int count=questionBiz.count();
map.put("total", count);//总条数
map.put("rows", list);//每页显示的条数
result=JSONObject.fromObject(map);
System.out.println(result);

return "success";
}

控制台打印的信息
信息: Server startup in 8148 ms
{"total":12,"rows":[{"answer":"A","answerb":"客户端静态网页","answerc":"客户端动态网页","subjectname":"jsp","answerd":"HTML网页","questioncontent":"关于jsp描述正确的是","questionid":2,"answera":"显示动态内容的服务器网页"},{"answer":"A","answerb":"客户端静态网页","answerc":"客户端动态网页","subjectname":"orcale","answerd":"HTML网页","questioncontent":"关于jsp描述正确的是","questionid":3,"answera":"显示动态内容的服务器网页"},{"answer":"A","answerb":"中间层","answerc":"数据层","subjectname":"jsp","answerd":"模型层","questioncontent":"jsp属于JAVAEE那层体系","questionid":4,"answera":"表示层"},{"answer":"A","answerb":"数据层t","answerc":"update","subjectname":"jsp","answerd":"HTML网页","questioncontent":"orcale用那个关键字插入数据","questionid":5,"answera":"表示层"},{"answer":"A","answerb":"数据层","answerc":"u数据层","subjectname":"jsp","answerd":"delete","questioncontent":"o谁是傻逼","questionid":6,"answera":"表示层"}]}![图片说明](https://img-ask.csdn.net/upload/201703/25/1490452427_488057.png)

getAllInfo()方法return的是"success"?,应该 return result; 吧