@RequestMapping(value = "/foreign_hereis.html") public String Edit_hereis(HttpServletRequest request, HttpServletResponse response) { String id = Untils.NotNull(request.getParameter("inhere_id_list")) ? request.getParameter("inhere_id_list") : ""; String status = Untils.NotNull(request.getParameter("is_here_status")) ? request.getParameter("is_here_status") : ""; foreignServices = (ForeignServices) springContextUtil.getBean("ForeignServices"); String s = ""; JSONObject object = new JSONObject(); String message = ""; try { if (Untils.NotNull(id)) { if (Untils.NotNull(status)) { String[] array = id.split(","); for (int i = 0; i < array.length; i++) { if (Untils.NotNull(array[i])) { FiForeigner foreign_ = foreignServices.QueryByid_fi(array[i]); foreign_.setIsHere(Integer.parseInt(status)); foreignServices.UpdataObject(foreign_); } } } } message = "是否再连信息保存成功!"; } catch (Exception e) { message = "是否再连信息保存失败!"; } finally { response.setContentType("text/Xml;charset=utf-8"); response.setHeader("Cache-Control", "no-cache"); response.setHeader("pragma", "no-cache"); response.setDateHeader("expires", 0); PrintWriter out = null; try { out = response.getWriter(); JSONObject object1 = new JSONObject(); object1.put("message", message); out.println(object1); } catch (IOException ex1) { ex1.printStackTrace(); } finally { out.close(); } // return new String(message.getBytes("utf-8"),"ISO-8859-1"); return null; } }
@RequestMapping(value = "/AjaxQuery.html") public String AjaxQuery( @RequestParam(value = "entryValue") String entryValue, HttpServletRequest request, HttpServletResponse response) { List<FiForeigner> foreignlist = null; String value = Untils.NotNull(entryValue) ? entryValue : ""; if (Untils.NotNull(value)) { foreignServices = (ForeignServices) springContextUtil.getBean("ForeignServices"); foreignlist = foreignServices.QueryByName("%" + value + "%"); } List list = new ArrayList(); if (foreignlist != null && foreignlist.size() > 0) { for (FiForeigner forei : foreignlist) { JSONObject object = new JSONObject(); // System.out.println(forei.getName()+" , "+forei.getPassportId()); if (Untils.NotNull(value)) { object.put("name", forei.getName()); object.put("pp_id", forei.getPassportId()); object.put("id", forei.getId()); } list.add(object); } } response.setContentType("text/Xml;charset=utf-8"); response.setHeader("Cache-Control", "no-cache"); response.setHeader("pragma", "no-cache"); response.setDateHeader("expires", 0); PrintWriter out = null; try { out = response.getWriter(); out.println(list); } catch (IOException ex1) { ex1.printStackTrace(); } finally { out.close(); } return null; }