模型
private int id;
@NotEmpty
private String fname;
@NotEmpty
private String lname;
@DateTimeFormat (pattern = "MM/dd/yyyy")
private Date birthday;
private String description;
Restful ws(POST方法)
@RequestMapping(value = "/save", method = RequestMethod.POST)
public
@ResponseBody
Contact save_api(@RequestBody @Valid Contact contact) {
System.out.println("asdasd");
conService.insert(contact);
return contact;
}
测试服务(json数据) {" fname":" Co 1 nguoi Khung"," lname":" Haha","生日":& #34; 10/10/2010","描述":""}
我使用MM / dd / yyyy格式(作为模型)发布数据,但此处出现错误:"客户端发送的请求在语法上不正确"
但是,如果我发布这些数据:
{" fname":" Co 1 nguoi Khung dung gan da"," lname":" Lan","生日&#34 ;:" 2010-10-10","说明":""}
它是成功的,将数据保存到数据库中。
谁能帮助我?#34;? 非常感谢!