Spring @ResponseBody can only return string type data resolution

Source: Internet
Author: User

Today I play with the Spring MVC framework, using AJAX to call the spring controller and return to the map object, suddenly found, hey, how can only return string in @response, I use the Spring 3 version is not low Ah, baffled its solution, Then go to the official forum to find the reason, good guy, many people have this experience, and seemingly some official staff also can not tell how to solve, others ask questions are shouting to submit the bug (it seems that the official support staff also have slag AH).
So go to Spring-vramework official website to view the document, have the following description
Jackson is supported directly on @ResponseBody and responseentity controllers methods for serializing different amounts of Detail for the same POJO (e.g. summary vs. detail page). This was also supported with view-based rendering by adding the serialization View type as a model attribute under a Specia L
This means that if you use @responsebody, Jackson needs to be quoted.
With this guideline, let's say, I poured into the following two jar package, OK, problem solving, @ResponseBody can finally be returned to the Ajax Map, or List object.

jackson-mapper-asl-1.9.12.jar jackson-core-asl-1.9.12.jar

Spring @ResponseBody can only return string type data resolution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.