ajax向后端传输pojo对象400错误

ajax向后端传输pojo对象400错误
1、前端代码

sms对象:
var sms = {
	taskId: '',
	taskTypeId : '',
	schemaId : '',
	destPhones : [],
	// destPhones.push("+86" + $("#callPhone").val());
	contractId : '', // 合同编号
	custName : '', //客户姓名
	bankName : '',// 银行
	accountNo : '',// 账号
	overdueAmount : '', //逾期金额
	carLoanAmount : '', //车贷逾期
	extensionAmount : '', //延保逾期
	insuranceAmount : '', //保险逾期
	maintainAmount : '',//保养逾期
	addedValueAmount : '',//增值额逾期
}

ajax请求:
function sendSms(sms, target, pt) {
	$.ajax({
		dataType : "json",
		type : "POST",
		contentType:'application/json;charset=UTF-8',
		url : contextPath + "/inbound/sendSmsTreansfer.json",
		data : JSON.stringify(sms),
		timeout : 30000,
		error : function handleAjaxError(xhr, textStatus, error) {
			if (textStatus === "timeout") {
				$.Alert("连接超时!请稍后再试");
			} else if (textStatus == "error") {
				$.Alert("系统繁忙,请稍后再试", null);
			} else {
				$.Alert("系统异常,请联系管理员!");
			}
		},
		beforeSend : function() {
			$.showPopupLayer();
		},
		complete : function() {
			$.closePopupLayer();
		},
		success : function(data) {
			if(data) {
				if(data.rtnCode == 101) {
					$.Alert("短信发送失败!");
				} else if(data.rtnCode == 102) {
					resendCountDown(target, pt + sms.schemaId + sms.destPhones[0].val(), parseInt(data.errMsg));
				} else {
					resendCountDown(target, pt + sms.schemaId + sms.destPhones[0].val(), 60);
				}
			}
		}
	});
}

2、后端代码

@RequestMapping(value = "/sendSmsTreansfer" ,method = RequestMethod.POST)
public String testTransfer(@RequestBody final SmsDiyVo sms,HttpSession session, Model model){
		System.out.println(1);
		return new String("redirect:/inbound/sendMessageDiyView.htm");
	}

3、原因:SmsDiyVo pojo对象里面没有构造方法、setter、getter
4、解决方法:在pojo对象里添加构造方法和stter、getter

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值