According to the docs (scroll down to the bottom) http://tapestry.formos.com/nightly/tapestry5/tapestry-core/guide/ajax.html

I should be able to return a JSONObject from an event method, but it throws an exception telling me all the possible return types..none of them appear to be JSONObject

I noticed that Sven's T5 component library includes a JSONResponseStream is this really necessary?


After looking at the AutoComplete component, I came up with the following code(I know, the @OnEvent isn't necessary):

   @OnEvent(value = "renderTreeData")
   Object onRenderTreeData() {

       JSONObject jsonObject = new JSONObject();
       jsonObject.put("id", "1");
       jsonObject.put("text", "A leaf node");
       jsonObject.put("leaf", true);

       JSONArray jsonArray = new JSONArray();
       jsonArray.put(jsonObject);

return new TextStreamResponse("application/json", jsonArray.toString());
   }



is this the proper way to go about this? do the docs need to be updated?

Thanks,
Mike



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to