How to write JSON response has been created by Will Hoover (Jan 15, 2008).

Content:

In your WebPage...

...

getRequestCycle().setRequestTarget(new IRequestTarget() {

	@Override
	public void detach(RequestCycle requestCycle) {
		// nothing to do here
	}

	@Override
	public void respond(RequestCycle requestCycle) {
		// Add JSON script to the response
		requestCycle.getResponse().write("{myJSON:'myValue'}");
	}
});

...

Reply via email to