可以請任何有經驗的人與Spring DispatcherPortlet處理後xmlHttpRequests,告訴我什麼是最好的方式來做到這一點?我使用YUI IO模塊和傑克遜對象映射器爲例:Spring-portlet POST ajax xmlHttpRequest
@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'
}
});
}
This在這裏你可以投票了春天的portlet環境將具有相同的支持問題那個普通的spring-mvc有。這@ResponseBody是,數據轉換成JSON等,現在據我所知一個人做手工......
編輯:想出解決方案
請:看看這個問題,這是更好地制定https://stackoverflow.com/questions/4782971/handling-ajax-requests-with-spring-portlet
http://stackoverflow.com/questions/4782971/handling-ajax-requests-with-spring-portlet似乎不再存在 – Eric 2011-02-08 18:08:14