开发者

how to send jsp array to Ajax?

开发者 https://www.devze.com 2023-03-28 08:36 出处:网络
Is there a way to return an array of strings from jsp to Ajax? How can I send it to the Ajax and read it as

Is there a way to return an array of strings from jsp to Ajax? How can I send it to the Ajax and read it as

xmlhttp开发者_如何学编程.responseText


I would suggest that you look into JSON as your transport format. Encode your Java String array into JSON and send this to your Javascript. It's a very lightweight format and there exist tons of Javascript frameworks (jQuery, mootools, dojo, you name it) that make working with it a pleasure.


DWR can be used to send array of strings to AJAX .

Using DWR for AJAX example

Easy Ajax for Java (DWR)

0

精彩评论

暂无评论...
验证码 换一张
取 消