亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

請大神解答,我請求page 結尾的請求,他進入了json里面處理?請大神看看什么原因造成的?跪謝。

請大神解答,我請求page 結尾的請求,他進入了json里面處理?請大神看看什么原因造成的?跪謝。

qq_綠葉也有_0 2018-05-09 21:00:59
?控制層代碼如下: ?//取到的哪個頁面 ????@RequestMapping("/dept.page") ????public?ModelAndView?page(){ ????????return??new?ModelAndView("dept"); ????} //新增部門的方法 ????@RequestMapping("/save.json") ????@ResponseBody ????public?JsonData?saveDept(DeptParam?param){ ????????sysDeptService.save(param); ????????return?JsonData.success(); ????}??//1 ????@RequestMapping("/Tree.json") ????@ResponseBody ????public?JsonData?tree(){ ????????List<DeptLevelDto>?dtoList?=?sysTreeService.deptTree(); ????????return?JsonData.success(dtoList); ????} ???請求處理攔截:如下 public?class?SpringExceptionResolver?implements?HandlerExceptionResolver?{ ????public?ModelAndView?resolveException(HttpServletRequest?request,?HttpServletResponse?response,?Object?o,?Exception?ex)?{ ????????String?url?=?request.getRequestURI().toString(); ????????ModelAndView?mv?; ????????String?defaultMsg?=?"System?error"; ????????//這里我們要求項目中的所有請求json數據,都使用json結尾 ????????if(url.endsWith(".json")){ ????????????if(ex?instanceof?SmallException?||?ex?instanceof?ParamException){ ????????????????JsonData?result?=?JsonData.fail(ex.getMessage()); ????????????????mv?=?new?ModelAndView("jsonView",result.toMap()); ????????????}else?{ ????????????????System.out.print(ex); ????????????????JsonData?result?=?JsonData.fail(defaultMsg); ????????????????mv?=?new?ModelAndView("jsonView",result.toMap()); ????????????} ????????????//我們要求項目中所有請求page頁面,都是用.page結尾 ????????}else?if(url.endsWith(".page")){ ????????????//log.error("unknow?page?exception,url"+?url,ex); ????????????JsonData?result?=?JsonData.fail(defaultMsg); ????????????mv?=?new?ModelAndView("exception",result.toMap()); ????????}else?{ ????????????//log.error("unknow?exception,url"+?url,ex); ????????????JsonData?result?=?JsonData.fail(defaultMsg); ????????????mv?=?new?ModelAndView("jsonView",result.toMap()); ????????} ????????return?mv; ????} } 業務層代碼:如下: @Resource private?SysDeptMapper?sysDeptMapper; //新增 public?void?save(DeptParam?param){ ????BeanValidator.check(param); ????if(checkExist(param.getParentId(),param.getName(),param.getId())){ ????????throw?new?ParamException("同一層級下存在相同的部門"); ????} ????SysDept?dept?=?SysDept.builder().name(param.getName()).parentId(param.getParentId()) ????????????.seq(param.getSeq()).remark(param.getRemark()).build(); ????dept.setLevel(LevelUtil.calculatelevel(getLevel(param.getParentId()),param.getParentId())); ????dept.setOperator("System");//TODO ????dept.setOperateIp("127.0.0.1");//TODO ????dept.setOperateTime(new?Date()); ????sysDeptMapper.insertSelective(dept); } 錯誤提示:如下 url:{}?,?param:{}/sys/dept/dept.page{}五月?09,?2018?8:38:40? 下午?org.springframework.web.servlet.PageNotFound?noHandlerFound警告: ?No?mapping?found?for?HTTP?request?with?URI?[/sys/dept/tree.json] ??in?DispatcherServlet?with?name?'spring'五月?09,?2018?8:38:40?下午 ???org.springframework.web.servlet.PageNotFound?noHandlerFound警告: ????No?mapping?found?for?HTTP?request?with?URI?[/favicon.ico]? ????in?DispatcherServlet?with?name?'spring'url:{}?,? ????param:{}/sys/dept/save.json{"parentId":["0"],"id":[""],"name":["shiye"],"seq":["1"], ????"remark":["gds"]}org.springframework.web.util.NestedServletException:?Handler? ????dispatch?failed;?nested?exception?is?java.lang.StackOverflowError ???? ???? ???? ????以上是新增部門信息,報的錯誤,數據庫測試鏈接成功
查看完整描述

1 回答

?
cxxyjsj

TA貢獻119條經驗 獲得超22個贊

異常日志里面寫的很清楚找不到tree.json,? 貼出來的代碼中RequestMapping是Tree.json, 大小寫不一致

查看完整回答
反對 回復 2018-05-10
  • 1 回答
  • 0 關注
  • 952 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號