点击提交后,jackson报错,"shopType":{"shopTypeId":"undefined"}
来源:4-13 前后端联调验证整体模块功能

杰哥大大
2018-01-14
com.fasterxml.jackson.databind.exc.InvailFormatException:Can not deserialize value of type java.lang.Long fromString"undefined:not a valid Long value at{Source:...."shopType":{"shopTypeId":"undefined"}....(through reference chain :com.lyf.webshop.entity.Shop["shopType"]->:com.lyf.webshop.entity.ShopType["shopTypeId"]
写回答
1回答
-
杰哥大大
提问者
2018-01-14
/** * */ $(function() { var initUrl = '/webshop/admin_shop/getshopinitinfo'; var registerShopUrl = '/webshop/admin_shop/registershop'; getShopInitInfo(); function getShopInitInfo() { $.getJSON(initUrl, function(data) { if (data.success) { var tempHtml = ''; var tempAreaHtml = ''; data.shopTypeList.map(function(item, index) { tempHtml += '<option data-id="' + item.shopTypeId +'">' + item.shopTypeName + '</option>'; }); data.areaList.map(function(item, index) { tempAreaHtml += '<option data-id="' + item.areaId + '">' + item.areaName + '</option>'; }); $('#shop-type').html(tempHtml); $('#area').html(tempAreaHtml); } }); $('#submit').click(function(){ var shop={}; shop.shopName=$('#shop-name').val(); shop.shopAddress=$('#shop-address').val(); shop.phone=$('#shop-phone').val(); shop.shopDesc=$('#shop-desc').val(); shop.shopType={ shopTypeId:$('#shop-type').find('option').not(function(){ return !this.selected; }).data('id') }; shop.area={ areaId:$('#area').find('option').not(function(){ return !this.selected; }).data('id') }; var shopImg=$('#shop-img')[0].files[0]; var formData=new FormData(); formData.append('shopImg',shopImg); formData.append('shopStr',JSON.stringify(shop)); var verifyCodeActual=$('#k1_captcha').val(); if(!verifyCodeActual){ $.toast('请输入验证码!'); return; } formData.append('verifyCodeActual',verifyCodeActual); $.ajax({ url:registerShopUrl, type:'POST', data:formData, contentType:false, processData:false, cache:false, success:function(data){ if(data.success){ $.toast('提交成功!'); }else{ $.toast('提交失败!'+data.errMsg); } $('#captcha_img').click(); } }); }); } })
0102018-01-15
相似问题