@RequestMapping(value = "insertBadge", method = RequestMethod.POST) @ResponseBody public long insertBadge(@ModelAttribute("badge") Badge badge, BindingResult bind, HttpServletRequest request) throws Exception { String datestr=request.getParameter("fillInDate"); //System.out.println(datestr); Date temp = DateUtil.parseDate(datestr, "yyyy-MM-dd HH:mm", Locale.ENGLISH); //System.out.println(temp); badge.setFillInDate(temp); badgeService.insertBadge(badge); return badge.getId(); }
http://www.iteye.com/problems/52416
发现个问题
用这个 $.ajaxSubmitForm("#searchForm",function(id)
提交表单后 火狐可以获取返回值ID,而IE则弹出个下载框
后台。
后来改完下面的这段 增加response
@RequestMapping(value = "insertBadge", method = RequestMethod.POST) @ResponseBody public void insertBadge(@ModelAttribute("badge") Badge badge, BindingResult bind,HttpServletResponse response, HttpServletRequest request) throws Exception { String datestr=request.getParameter("fillInDate"); //System.out.println(datestr); Date temp = DateUtil.parseDate(datestr, "yyyy-MM-dd HH:mm", Locale.ENGLISH); //System.out.println(temp); badge.setFillInDate(temp); badgeService.insertBadge(badge); response.setCharacterEncoding("UTF-8"); response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.write(String.valueOf(badge.getId())); out.flush(); }