Hello. I'm trying to create a wicket component out of FlexiGrid http://www.flexigrid.info/ .
The javascript for the component requires an address from which it will receive data in the form of a JSON response. I'm not sure what is the best way to go about it. Simple and most ugly approach would be to have something of a "Controller Page" a page that takes parameters such as the entity that is being retrieved and also paging info, sort order, etc and returns the JSON response. I do not like this aproach as, most obvious reason is that it would not be obvious from the component what you need to do in order to get it to work. I would much more preffer to having a callback method that returns the json. So I have created a AbstractDefaultAjaxBehavior clientConnectBehavior = new AbstractDefaultAjaxBehavior() { protected void respond(AjaxRequestTarget ajaxRequestTarget) { ajaxRequestTarget.prependJavascript("{page: 1, total: 239 }"); } and used clientConnectBehavior.getCallbackUrl() as the url passed to the flexigrid. Unfortunately the problem is the response when invoked is wrapped in a <ajax-response><evaluate encoding="wicket1"> <?xml version="1.0" encoding="UTF-8"?> <ajax-response><evaluate encoding="wicket1"><![CDATA[{page: 1,total: 239}]]></evaluate></ajax-response> So my question is how to get only the JSON part without the <?xml version.>, <ajax-response> . and <CDATA> decoration. Can it be bypassed? Shoul I override something in AbstractDefaultAjaxBehavior? Or any other ideea to go about the problem. Thank you, Serban