Monica. Shiralkar wrote:a) Check how to create and populate values into HTML table using Jquery.
b) Check how to send data from ajax Action class as ajax response. I know how to send a string (simply use out.println and flush out variable but now I need to figure out how to send arraylist).Also I need to know how is JSON involved here as you have mentioned.
Monica. Shiralkar wrote:I think to do this I need to add all content of ArrayList into an JSON array
and follow it with statements to out.println(jsonarray) and flush the out variable?
A question I have in mind is how was this done when JSON was not there?
Monica. Shiralkar wrote:My approach is to send AJAX request to Struts2 Action using Jquery and render the response on the JSP page
Is it correct with respect to a and b?
Then there are methods to hook them into the DOM such as: append(), appendTo(), before() and so on.
Please properly indent your code
The easiest way to send data in a response is by encoding it as JSON
Monica. Shiralkar wrote:thanks. On printing a JSON (to check its content) , which was created after converting an arrayList to JSON, I see the below but no contents:
I want to see the JSON the one created by myArrayList.toJSON method but I see the above after doing a System.out.println or using toString().
Apparently the JSON library you've chosen is rather poor
org.json is not a native package.
Monica. Shiralkar wrote: On calling the web page I am getting the below displayed:
$("ul").append("<li>Msg ID "+this['msg_id']+"</li> <li>Message: "+this['message']+"</li><br />");
Now I expected above code to display Json data in HTML table format.