后台打印出来了,前段也写了ajax  function(data) data值也alert出来了。 都是一致的数据

解决方案 »

  1.   

    检查你的Json格式拼的是否正确,要符合easyui规范,格式大致这样的:
    String json = "{\"total\":" + total + ",\"rows\":"+ JSONArray.fromObject(goodsTypes).toString() + "}";
    还有json的key要和list中对象的属性名一致,否则也无法正常显示数据,主要就这2点需要注意,具体格式你参考一下eayui包下的datagrid.json的example。
      

  2.   

    public String load()throws Exception{
    HttpServletResponse response = ServletActionContext.getResponse();
    response.setContentType("text/html;charset=UTF-8");
    PVTaskDAO dao = new PVTaskDAOImpl();
    task = dao.findById(id);
    String json = "{\"total\":" + total + ",\"rows\":"+ JSONArray.fromObject(task).toString() + "}";
    response.getWriter().write(json);
    return null;
    }field的名字和对象的属性名都是一致的,可就是不出来。
      

  3.   

    你返回的Json字符串放到Json解析工具看一下有没有错什么的,最好写一个单独的Test页面,就放一个datagrid,用firebug仔细看看请求和响应的数据。
      

  4.   

    我换了种写法 就是在struts.xml文件中
    <action name="showList" class="com.test.action.QueryPVTaskAction" method="showList">
    <result name="success" type="json">
    <param name="root">tasks</param>
    </result>
    </action>
    就行了。
    别的问题是list的所有对象是显示了,可是load的单个对象也是放到root中  不知道为什么出不来??
      

  5.   


    那么后台应该是 tasks  接受啊