Spring 3 JSON with MVC

前端 未结 8 954
温柔的废话
温柔的废话 2020-12-23 02:33

Is there a way to build Spring Web calls that consume and produce application/json formatted requests and responses respectively?

Maybe this i

相关标签:
8条回答
  • 2020-12-23 02:43

    Check this one out

    Adding support for JSON and XML views

    Source code for Spring Finance Manager

    0 讨论(0)
  • 2020-12-23 02:43

    This feature is now part of Spring since version 3.0. You can simply use the @ResponseBody annotation to specify that you want the return value from your request handler methods to be serialized to JSON and sent as the response body. See http://blog.springsource.com/2010/01/25/ajax-simplifications-in-spring-3-0/

    0 讨论(0)
  • 2020-12-23 02:46

    It seems that DWR framework looks very close to what you want to get.

    0 讨论(0)
  • 2020-12-23 02:49

    There is no pre-packaged way to do what you want as Jersey is nicely integrated with Spring via the Jersey-Spring API so there's really no reason to re-invent the wheel.

    0 讨论(0)
  • 2020-12-23 02:55

    In case other ppl get here later: http://blog.springsource.com/2010/01/25/ajax-simplifications-in-spring-3-0/ was the most useful link for me. That finally made me understand the model (after less than a day of searching).

    0 讨论(0)
  • 2020-12-23 02:56

    Since spring-mvc 3.0 official support for Ajax remoting with JSON is provided as part of Spring MVC. This includes support for generating JSON responses and binding JSON requests using the Spring MVC @Controller programming model.

    see here

    0 讨论(0)
提交回复
热议问题