Hi, I'm new to tapestry, now I want to create a page which could handle ajax request and return JSON response. But I can't get it work. Here is what I did:
First I have a page which extends BasePage and implement IJSONRender: public abstract class JsonPage extends BasePage implements IJSONRender { public void renderComponent(IJSONWriter writer, IRequestCycle cycle) { System.out.println("RenderJSON!!"); writer.array().put("some data"); } } Then I have Home.page: <page-specification class=".....JsonPage"> </page-specification> Then I have Home.html: <html jwcid="@Shell" title="Test"> <body jwcid="@Body"> <script> dojo.require("tapestry.event"); dojo.event.connect(tapestry, "loadJson", function(type, data, http, kwArgs){ alert("load json!"); alert("data:" + data); for (var e in data) { alert(e + ":" + data[e]); } }); tapestry.bind("http://127.0.0.1:8080/war/app", {}, true); </script> </body> </html> The client side will show a message box said "load json!", but the json data that client retrieved is always an empty object. Also, the server console does not print "RenderJSON!!", which means that the renderComponent of my TestPage was never called. I don't know what to do. Could somebody help me out? Thank you very much!! -- View this message in context: http://old.nabble.com/JSON-in-Tapestry-tp26885074p26885074.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org