psot请求参数放于requestbody中

Invalid property 'products[0][cartId]' of bean class [com.wondersgroup.employeeBenefits.app.bean.requestBean.OrdersCreateBean]: Property referenced in indexed property path 'products[0][cartId]' is neither an array nor a List nor a Map; returned value was [1]
public @ResponseBody String saveDocumentBook(@RequestBody(可加) 对象 x, HttpServletRequest request)
$.ajax({
url:"${pageContext.request.contextPath}/"+$("#requesturl").val(),
type:"post",
data:JSON.stringify(param),/////这个参数对应的就是requestbody中的,位置传递复杂格式要注意(表单提交的就是放在requestbody中)
            headers:head,
dataType:'json',
contentType: "application/json",//不是复杂格式的用这种方式传不了,如果又用了,不是复杂的部分可以放在参数中
success:function(data){
$("#result").val(JSON.stringify(data));
}
});
//data中的就在body中,参数可以在header,url-paramter中,流的话在binary中。
@RequestBody 接受body中的,其实所有的参数都在request中只是用标签映射出来

猜你喜欢

转载自yuhuiblog6338999322098842.iteye.com/blog/2258444
今日推荐