Spring MVC3 annotations @responsebody automatically return to Jason

Source: Internet
Author: User

The third annotation using spring MVC3 @responsebody

For example:

[Java]View PlainCopyprint?
  1. @ResponseBody
  2. @RequestMapping ("/list")
  3. Public list<string> List (Modelmap modelmap) {
  4. String hql = "Select C from clothing C";
  5. page<clothing> page = new page<clothing> ();
  6. Page.setpagesize (6);
  7. page = clothingserviceimpl.queryforpagebyhql (page, HQL);
  8. return Page.getresult ();
  9. }

You can then return the JSON using the spring MVC default configuration, but you'll need Jackson's jar package.

Spring MVC3 annotations @responsebody automatically return to Jason

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.