springmvc无法接收ajax提交form表单的实体类信息

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_36411874/article/details/79077597

前端接受数据:

function commitConfirm(){

var recept_sn=document.getElementById("recept_sn").value;
alert(recept_sn);
var customer_name=document.getElementById("customer_name").value;
alert(customer_name);
alert($('#predealForm').serialize());
$.ajax({
            url:"${pageContext.request.contextPath}/ida40/pacify/operate/pacifyTaskAccept.jhtml",
            type:"post",
            data:$('#predealForm').serialize(),
            processData:false,
            contentType:false,
            success:function(data){
                console.log("over..");
            }
});

}

前端页面:

 <form id="predealForm">

<input id="recept_sn" name="recept_sn" value="" class="ida-input-text" style="width:220px">
<ida:idaButton value="查询" onclick="showUserDetail();" />

</form>


后台:

   @RequestMapping(value = "/pacifyTaskAccept.jhtml", method = RequestMethod.POST)
    public void entry(HttpServletResponse response, HttpServletRequest request,ModelMap model,@ModelAttribute PacifyTaskReceiveDTO pacifyTaskReceiveDTO) throws BOException,
           BIException, ServletException, IOException {
    System.out.println(pacifyTaskReceiveDTO);
    System.out.println(pacifyTaskReceiveDTO.getService_no());
    System.out.println(pacifyTaskReceiveDTO.getCustomer_name());
    System.out.println(pacifyTaskReceiveDTO.getDealObjectId());
   
    }


解决方法:

去掉ajax中的即可。

   processData:false,
            contentType:false,

展开阅读全文

没有更多推荐了,返回首页