If you are using Spring 3.0, I highly recommend using Spring's RESTful Web Services instead, so you don't need to do anything in the Controller, it stays the same, and now the client requests what representation they want instead. It supports json, xml, html, rss, atom to name a few. But in all cases the controller code is the same, as it wouldn't be the Controller's responsibility.
Mark's right, if you are using restful webservice it's just a matter of annotating methods in your Resource with
public Response/Bean someAction()
Joined: Jul 09, 2007
Thanks for your interest regarding my post.
have you tried jettison, Jettison library is for for JSON serialization and deserialization
I havent heard about jettison, i tried to look up a bit on how to configure this in my spring controller but cant find enough resource on how to do this
If you are using Spring 3.0, I highly recommend using Spring's RESTful Web Services
Unfortunately, the web app is built on Spring 2.5 module and Web services is not an option as of the moment.
While googling at the net, I found this nice library Spring-JSON that has nice tutorial on how to integrate it with
Spring MVC. I am currently unsure though if this is good. Have you heard about this or has anyone used this?
Joined: Oct 29, 2006
I haven't handcrafted any JSON format for a long time, but I think the basic idea should be something like this, you have your POJOS and you need to convert them to JSON object of your selected choice of JSON lib, then output them as JSON type of response(set the proper type(MIME) of header in http I think it should be "application/json"), GSON is another choice. and the user guide is http://sites.google.com/site/gson/gson-user-guide