struts2 Action返回的json对象无法绑定到Ext grid中

大家好:

后台返回的json对象格式上好像出了点问题,参考成功的例子,json对象应该是以下格式:
{
total: 2,
root : [
{ id: 1, firstname: 'Bill', occupation: 'Gardener' }, // a row object
{ id: 2, firstname: 'Ben' , occupation: 'Horticulturalist' } // another row object
]
}

可是我现在的json对象只有root 里面这部分,如下:
{
{ id: 1, firstname: 'Bill', occupation: 'Gardener' }, // a row object
{ id: 2, firstname: 'Ben' , occupation: 'Horticulturalist' } // another row object
}

我从Ext的js文件,struts2的xml文件,后台action,都看了一遍也不知道是什么造成的?
Ext相关部分:
[code="javaScript"]
ds: new Ext.data.Store({
url : 'getCustomersList.action',
reader : new Ext.data.JsonReader({totalProperty : "total", root : "root"},
[{name : "customerCode", type : "string"},
{name : "customerName", type : "string"},
{name : "conDist", type : "boolean"},
{name : "supDist", type : "boolean"},
{name : "delDist", type : "boolean"},
{name : "consigneeDist", type : "boolean"},
{name : "dcCompDist", type : "boolean"},
{name : "shippingCompDist", type : "boolean"},
{name : "customerRank", type : "string"},
{name : "creditRank", type : "string"},
{name : "availDist", type : "boolean"}])
})
[/code]
struts2 xml相关部分
[code="xml"]



customersInfoList
true



[/code]

我的lib是:struts2-json-plugin-2.1.8.1.jar和json-lib-2.1.jar

在后台写成root:[]或前台reader里边root:""

后台写到客户端的json串是什么样子的

json数据里 "total"和 "root"这2个属性都没有

后台拼装数据不对了

前台配好了你就专心改后台,不想改后台就改前台,两个都不改神仙来了也帮不了你

代码是死的,人是活的。

呵呵。痛苦吧。

[code="java"]
var dataStr = "";
function getCombData() {
var myCheckboxItems = [];
Ext.Ajax.request({
url : 'system/Role/selectList.do',
sync : true,
success : function(response, options) {
var result_data = Ext.util.JSON.decode(response.responseText).root;

for (var i = 0; i < result_data.length; i++) {
var boxLabel = result_data[i]["boxLabel"];

var name = result_data[i]["name"];

var inputValue =result_data[i]["inputValue"];
myCheckboxItems.push({
boxLabel : boxLabel,

name : 'user.roleId',
inputValue: inputValue
});

            // alert(myCheckboxItems.length);
}

[code="java"]
/**
* ExtGrid使用
* 列表
* @throws IOException
*/
public void selectList() throws IOException
{
System.out.println("### Role selectList ");
ArrayList list = (ArrayList) roleManager.selectList();

    Hashtable userRolehash = new Hashtable(); //角色权限哈希
    String userIdStr = (null==this.getRequest().getParameter("userId")) ? "0" : this.getRequest().getParameter("userId"); //权限元素
    java.lang.Long userId =  Long.parseLong(userIdStr);
    System.out.println("### RoleAction getRoleTree userId = "+userId);
    List userRoleList =userRoleManager.getUserRoleList(userId);

    for (int i = 0; userRoleList != null && i < userRoleList.size(); i++) {
        UserRole rserRole = (UserRole )userRoleList.get(i);
        userRolehash.put(rserRole.getRoleId(), rserRole);
        System.out.println("^^^ RoleAction getRoleTree rserRole.getId() = "+rserRole.getId());
    }       

    String result="{root:[";
    for (int i = 0; list != null && i < list.size(); i++) {
        role = (Role)list.get(i);
        System.out.println("#@@! role.getId() = "+role.getId());
        if(userRolehash.containsKey(role.getId())){
            /**选中*/
            result=result+"{boxLabel:'"+role.getName()+"',name: 'TTypeID',inputValue:'"+role.getId()+"',checked: true}";
        }else{
            result=result+"{boxLabel:'"+role.getName()+"',name: 'TTypeID',inputValue:'"+role.getId()+"'}";
        }

        if(i!=list.size()-1) result = result+",";
    }
    if (!"".equals(result)) {
        result+="]}";
    }
    outJsonString(result);
}

[/code]
}
});
return myCheckboxItems;
};

[/code]

后台的json格式没有配置好。。

[code="java"]String json = JsonUtil.list2json(empInfoList);

            // System.out.println(json);
            // 定义JSON格式化数据
            StringBuffer sb = new StringBuffer();
            sb.append("{totalProperty:"); // totalProperty: 总共记录行数
            sb.append(totalCount);
            sb.append(",root:");
            sb.append(json);
            sb.append("}");
            out.print(sb.toString());[/code]