第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

ajax請(qǐng)求異常捕獲的問(wèn)題

在getAjacError方法里面除0操作,跑到ajacError.js里面,直接就進(jìn)了error,無(wú)法請(qǐng)求成功??

https://img1.sycdn.imooc.com//5ba3b67f0001fc8304100122.jpg

https://img1.sycdn.imooc.com//5ba3b6810001656806440291.jpg

https://img1.sycdn.imooc.com//5ba3b68200017f3911000286.jpg

https://img1.sycdn.imooc.com//5ba3b70b0001372906570260.jpg

https://img1.sycdn.imooc.com//5ba3b70b0001a65108380176.jpg


正在回答

7 回答

將 @ControllerAdvice 換成 @RestControllerAdvice

1 回復(fù) 有任何疑惑可以回復(fù)我~

進(jìn)error是因?yàn)閖s無(wú)法識(shí)別你的data對(duì)象,因?yàn)槟愕膁ata對(duì)象不是json格式,所以進(jìn)入了你定義的回調(diào)函數(shù)的error方法。其實(shí)請(qǐng)求是成功的,只是你用的注解不是@RestControllerAdvice

0 回復(fù) 有任何疑惑可以回復(fù)我~
@ExceptionHandler(value?=?Exception.class)
public?void?exceptionHandler(HttpServletRequest?request,?HttpServletResponse?response,
?????????????????????????????Exception?e,?Model?model)?throws?Exception?{
????if?(isAjax(request))?{
????????//?向response中寫(xiě)json數(shù)據(jù)
????????response.setCharacterEncoding("utf-8");
????????response.setContentType("application/json;?charset=utf-8");
????????PrintWriter?writer?=?response.getWriter();
????????writer.write(gson.toJson(JsonResult.errorException(e.getMessage())));
????}?else?{
????????request.setAttribute("exception",?e);
????????request.setAttribute("url",?request.getRequestURL());
????????request.getRequestDispatcher("/templates/error.html").forward(request,
????????????????response);
????}
}


0 回復(fù) 有任何疑惑可以回復(fù)我~

同問(wèn)啊

0 回復(fù) 有任何疑惑可以回復(fù)我~

怎么解決的,我也感覺(jué)很奇怪


0 回復(fù) 有任何疑惑可以回復(fù)我~

已根據(jù)@玩蠟筆小破孩同學(xué)的方法解決了問(wèn)題,感謝

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

ajax請(qǐng)求異常捕獲的問(wèn)題

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)