在编程实现过程中,前台采用ajax的post方法提交数据,后台controller代码如下:
@RequestMapping(value = "/changeEvents",method = RequestMethod.POST)
@ResponseBody
public boolean changeEvents(String id,int daydiff,int minudiff){
boolean retult=false;
......
return retult;
}
搜索了很久,终于找到答案。因为采用了@ResponseBody,把对象转化为json格式,但缺少转换依赖的jar包,所以报错。
解决办法:引入jackson-core-asl,jackson-mapper-asl两个jar包。
可调用网络jar包(在pom.xml哄插入):
<span style="font-family:SimSun;font-size:12px;"><dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<span> </span><artifactId>jackson-core</artifactId>
<version>2.5.3</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency></span>