extdirectspring 方法不起作用
我使用 extdirectspring 为我的 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();
}
这是我在客户端使用的代码:
directory.getPeople(id, function(result) {
console.log(result);
});
这是 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"
};
I set up ext direct for my Spring MVC app using extdirectspring. I am able to retrieve primitives and Strings and use them in ext.js. When I try to retrieve a list of objects, I am getting "undefined" on the javascript side. Is there anything special that I need to do to the Person class to get it to work?
I annotated the following code:
@ExtDirectMethod(ExtDirectMethodType.STORE_READ)
@Override
public Collection<Person> getPeople(String groupId) {
Group group = GroupManager.getGroup(groupId);
return group.getPeopleList();
}
This is what I am using on the client side:
directory.getPeople(id, function(result) {
console.log(result);
});
Here is what app.js looks like:
Ext.ns('Ext.app');
Ext.app.REMOTING_API = {
"actions":{
"directory":[{
"name":"getID","len":0
},{
"name":"getPeople","len":1
}
]},
"type":"remoting",
"url":"/test/action/router"
};
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过使用 ExtDirectStoreResponse 类?它确实使用集合,但也管理一些在商店中使用的有用值。
这是使用 STORE_READ 时使用的方法。该方法注释期望请求与 ExtDirectStoreReadRequest 类中的值匹配。这是进行存储读取时使用的参考。 https://github.com/ralscha/extdirectspring/wiki/Store-Read-Method
另外,您可以设置一个 ExtJs 存储并调用,而不是直接调用该方法
Have you tried using the ExtDirectStoreResponse class? It does use a collection but also manages some useful values for use in the store.
This is the approach to use when using the STORE_READ. That method annotation is expecting the request to come in matching values in the ExtDirectStoreReadRequest class. This is the reference to use when doing a store read. https://github.com/ralscha/extdirectspring/wiki/Store-Read-Method
Also, instead of calling the method directly, you would set up an ExtJs store and call