idea and spring5 stepped pit

ssm json data transfer type and Integration

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.8</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.8</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.9.8</version>
</dependency>

依赖这三个第三方jar包即可,Springmvc-xml no longer necessary to configure

the Controller annotate layer, to complete the transmission format, such as front and rear ends json:

@RequestMapping("/updatepwd")
public @ResponseBody boolean updatepwd(Coach coach){
boolean flag = false;
if(coachService.updateByPrimaryKeySelective(coach)==1){
flag = true;
}else {
flag = false;
}
return flag;
}
 
@ResponseBody annotation was compiled for the return json data format, such as the previous stage can accept a ajax json format 

if the method parameters to accept json format data, annotate parameters before @RequestBody
 

 

Guess you like

Origin www.cnblogs.com/zhengcheng-java/p/11431582.html