Java extdirectspring方法不工作
我使用为我的Spring MVC应用程序设置ext direct。我能够检索原语和字符串,并在ext.js中使用它们。当我试图检索对象列表时,我在javascript端得到了“未定义”。我需要对Person类做什么特殊的事情才能让它工作吗 我对以下代码进行了注释: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)
@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”}正如我提到的,我需要查看html和js
@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();