Is it possible to have a Spring controller return JSON formatted data instead of a physical view (jsp file)? All of the interfaces I have seen require you to return a ModelAndView. I could achieve what I want to by using plain servlets but I'd like to take advantage of Spring's IOC features.
Thank you
Jason
Adeel Ansari
Ranch Hand
Joined: Aug 15, 2004
Posts: 2874
posted
0
Here is the example code snippet using json-simple.jar,
You can return just a String, you can return null, you can return a View technology object like say JstlView, and also you can just return an object that is the Model, it doesn't always have to be a ModelAndView object.