日期:2014-05-16  浏览次数:20636 次

扩展Spring MVC 用以支持Controller对Ajax的处理

Spring Mvc中没有特别针对于Ajax请求的处理Controller.但是AbstractController和?
SimpleFormController也是可以针对Ajax的请求给与相应的.但显得有一点点的不自然.?

Java代码??收藏代码
  1. @Override??
  2. protected?ModelAndView?onSubmit(HttpServletRequest?request,?HttpServletResponse?response,?Object?cmd,??
  3. ????????BindException?ex)?{??
  4. ????String?userId=request.getParamater("userId");??
  5. ?????????????????Map?userInfoMap=userDao.getUserBaseInfo(userId);??
  6. ?????????????????JSONObject?object?=?new?JSONObject();??
  7. ?????????????????object.