弹簧portlet的POST阿贾克斯xmlHtt prequest [英] Spring-portlet POST ajax xmlHttpRequest
问题描述
能否取悦任何人谁与加工后xmlHtt prequests经验与Spring的DispatcherPortlet,告诉我什么是做到这一点的最好方法是什么?我使用YUI IO模块和杰克逊对象映射器为例:
Could please anybody who has experiences with processing post xmlHttpRequests with Spring DispatcherPortlet, tell me what is the best way to do it ? I'm using YUI io module and Jackson Object Mapper as an example :
@ResourceMapping(value="stuff")
public void method(ResourceResponse response){
Person person = new Person();
person.setWeight(150);
ObjectMapper mapper = new ObjectMapper();
try{
mapper.writeValue(response.getWriter(), person);
}
...
}
阿贾克斯:
function() {
var A = AUI();
A.io("<portlet:resourceURL id="stuff" />", {
method: 'POST',
data: {
description: 'value'
}
});
}
这 是问题,你可以投票了那年春天portlet的环境中也会有同样的支持,即常见的弹簧MVC有。这是@ResponseBody,数据转换成JSON等。现在AFAIK一个人做手工......
This is the issue where you can vote up that spring-portlet environment will have the same support that common spring-mvc has. Which is @ResponseBody, data conversion to JSON etc. Now AFAIK one has to do it manually...
编辑:想出解决办法
请:看看这个问题,这是更好地制定<一href="http://stackoverflow.com/questions/4782971/handling-ajax-requests-with-spring-portlet">Handling与Spring的portlet Ajax请求
PLEASE: Take a look at this issue which is better formulated Handling Ajax requests with Spring portlet
推荐答案
我想在春天的portlet响应Ajax请求的最佳方式在本博客文章中描述的元帅的Json使用杰克逊的数据在Spring MVC JAXB标注
I suppose the best way to respond to ajax requests in spring portlets is described in this blog post Marshal Json data using Jackson in Spring MVC with Jaxb Annotations
这也是有帮助的<一个href="http://rwehner.word$p$pss.com/2010/06/09/2-ways-to-create-json-response-for-ajax-request-in-spring3/"相对=nofollow>创建JSON响应春季AJAX请求3.0
遗憾的是没有那么花哨,因为这将是弹簧网络MVC
Unfortunately it is not so fancy as it would be in spring-web-mvc
这篇关于弹簧portlet的POST阿贾克斯xmlHtt prequest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!