Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java extdirectspring方法不工作_Java_Spring_Spring Mvc_Extjs_Ext Direct - Fatal编程技术网

Java extdirectspring方法不工作

Java extdirectspring方法不工作,java,spring,spring-mvc,extjs,ext-direct,Java,Spring,Spring Mvc,Extjs,Ext Direct,我使用为我的Spring MVC应用程序设置ext direct。我能够检索原语和字符串,并在ext.js中使用它们。当我试图检索对象列表时,我在javascript端得到了“未定义”。我需要对Person类做什么特殊的事情才能让它工作吗 我对以下代码进行了注释: @ExtDirectMethod(ExtDirectMethodType.STORE_READ) @Override public Collection<Person> getPeople(String groupId)

我使用为我的Spring MVC应用程序设置ext direct。我能够检索原语和字符串,并在ext.js中使用它们。当我试图检索对象列表时,我在javascript端得到了“未定义”。我需要对Person类做什么特殊的事情才能让它工作吗

我对以下代码进行了注释:

@ExtDirectMethod(ExtDirectMethodType.STORE_READ)
@Override
public Collection<Person> getPeople(String groupId) {

    Group group = GroupManager.getGroup(groupId);
    return group.getPeopleList(); 
}
下面是app.js的外观:

Ext.ns('Ext.app');
Ext.app.REMOTING_API = {
    "actions":{
        "directory":[{
            "name":"getID","len":0
        },{
            "name":"getPeople","len":1
        }
    ]}‌​,
    "type":"remoting",
    "url":"/test/action/router"
};

您是否尝试过使用ExtDirectStoreResponse类?它确实使用了一个集合,但也管理了一些在存储中使用的有用值

@ExtDirectMethod(ExtDirectMethodType.STORE_READ)
public ExtDirectStoreResponse<Person> load()
{
    Group group = GroupManager.getGroup(groupId);
    Collection<Person> people = group.getPeopleList();

    return new ExtDirectStoreResponse<Person>(people.size(), people);
}

我需要看看HTML和js。你必须在spring上做一个到自动生成的js的链接。下面是app.js:
Ext.ns('Ext.app');Ext.app.REMOTING_API={“actions”:{“directory”:[{“name”:“getID”,“len”:0},{“name”:“getPeople”,“len”:1}]},键入“:“REMOTING”,“url”:“/test/action/router”}@ExtDirectMethod(ExtDirectMethodType.STORE_READ)
public ExtDirectStoreResponse<Person> load()
{
    Group group = GroupManager.getGroup(groupId);
    Collection<Person> people = group.getPeopleList();

    return new ExtDirectStoreResponse<Person>(people.size(), people);
}
store.load();