
本文共 2488 字,大约阅读时间需要 8 分钟。
��������������� JSON ������
��� Spring MVC ������������������ JSON ��������������� JSON ��������������������������������������������������������������� JSON ������������������������
������ JSON ������
��������� JSON ������������������������������������������������������������������������������������
@RequestMapping(value = "/param12")public String getValue12(@RequestBody Student student) { System.out.println(student); return "mmm";}
���������������������@RequestBody
������������ Spring MVC automatic ������ HTTP ������������������������������������������ Student ������������������������������������������ Student ��������������������������� deserializer ������������������������������������ JSON ���������������������������
������ JSON ������
��������� JSON ������������������������������ @RestController
��������������������� @ResponseBody
��� @Controller
annotatins������������������ Java ��������������� JSON ������������������
��������������������� JSON ������������������
@RequestMapping("/param11")@ResponseBodypublic Student getValue11() { Student student = new Student(); student.setsId(1); student.setsName("wang"); student.setsAddress("������"); return student;}
������������ JSON ������������������������������������������ List Student���
@RequestMapping("/param11")@ResponseBodypublic ListgetValue11() { List list = new ArrayList<>(); Student student1 = new Student(1, "wang111", "������111"); Student student2 = new Student(2, "wang222", "������222"); list.add(student1); list.add(student2); return list;}
��������������������������������������������������������������� @RequestMapping
������������������������������������
@RequestMapping(value = "/param11", produces = "text/html;charset=utf-8")public String getValue11() { return "������";}
������ JSON ������������
������������ JSON ������������������������������������������������������������������ JSON ��������������������������������������� Jackson ��������������� Maven ������������
com.fasterxml.jackson.core jackson-databind 2.11.4
������������������������ JSON ������������������������������������ fastjson
���������������
com.alibaba fastjson 1.2.75
������
��������������������������������������� Spring MVC ������������������ JSON ���������������������������������������������������������������������������������������������
发表评论
最新留言
关于作者
