人能否提供一個教程在那裏我可以在我的Spring MVC應用程序中使用JSON庫進行數據交換整合阿賈克斯?????我必須使用與阿賈克斯jQuery的在我的應用程序春天AJAX JSON jQuery的
1
A
回答
2
2
+0
但在我們的項目中使用spring 2.6。 – apoorva 2010-07-26 04:41:15
1
http://api.jquery.com/jQuery.ajax/ 這是很容易,你可以從RestEasy的開始如何實現基本RestWEbservice, 那麼你就可以從網頁Ajax調用該服務,然後從該服務JSON返回並解析它很容易,如果你找不到我可以幫你
春天裏寫控制研究呃這樣的服務
@GET
@Produces({MediaType.APPLICATION_JSON})
@Path("getAllAlbums")
public String getAllAlbums() {
List<Album> albums = photoService.getAlbums();
String albumListasJson = jgen.getFilteredJsonString(albums);
return albumListasJson;
}
這是JSON庫
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<classifier>jdk15</classifier>
<version>2.4</version>
</dependency>
和阿賈克斯
function getAlbums(){
$.ajax({
type: "GET",
url: "../rest/xxxx/" + userID,
dataType: "text", //"json"
cache : "false",
//content : "document.body",
success: function(msg) {
albums = "{\"albums\":" + msg + "}";
tplAlb = tmpls['viewId-01'];
if (tplAlb && albums) {
data = JSON.parse(aaaa);
if (data.albums.length == 0) {
$.post("../rest/cccccc/" + userID + "/" + "aaaaaaa");
getAlbums();
}
// alert(data.albums.length);
}
}
});
}
相關問題
- 1. jQuery的AJAX文件春天控制器
- 2. 春天mvc傑克遜json
- 3. 出春天Ajax調用START_ARRAY令牌
- 4. Android的JSON發送到春天
- 5. 春天@ResponseBody JSON - 返回名爲變量
- 6. 春天開機,春天的OAuth2,休息
- 7. 使用jQuery JSON對象發佈到春天3控制器
- 8. 春天 - 從JSON響應網頁
- 9. json無限遞歸與春天roo
- 10. 注漿JSON參數 - 春天JPA
- 11. 春天數據JSON填充器失敗
- 12. jQuery的AJAX JSON parseerror
- 13. 春天的RowMapper
- 14. 春天的oauth2
- 15. AspectJ的春天
- 16. 春天的WebSocket
- 17. 春天。放心
- 18. jquery Ajax和json
- 19. jQuery ajax dataType:「json」
- 20. jQuery Ajax PHP JSON
- 21. jQuery Ajax setTimeout JSON
- 22. 春天在露天
- 23. ajax jquery在春季支持mvc
- 24. 春季REST web服務與JSON參數使用jquery AJAX
- 25. 春天休息嗎?
- 26. 不能在春天mvc表格中使用ajax
- 27. 春天mvc jquery模態框和iframe
- 28. 從春天控制器和jQuery的.post()方法得到適當的json
- 29. 春天的Servlets mvc
- 30. 春天的oauth2 InsufficientAuthenticationException
我試着用這個教程...我已經下載了json2.2.3 jar文件.. 。它包含本教程中提到的flexjson.JSONSerializer類嗎?或者它們在一起不同? – apoorva 2010-07-23 11:23:10
flexjson是http://flexjson.sourceforge.net/ – JoseK 2010-07-23 12:33:05
額外庫,一個人在這裏者優先??? Flexjson還是spring-json? flexjson庫的任何地方都與flex有關嗎? – apoorva 2010-07-26 04:39:59