@RequestMapping(
     value = "/preEditNsx",
     method = RequestMethod.GET,
     produces = MediaType.APPLICATION_JSON_VALUE,
     consumes = MediaType.APPLICATION_JSON_VALUE)
 public @ResponseBody String preEditNsx(@RequestParam("nsxMa") String nsxMa) {
   //		System.out.println("****" + nsxMa + "****");
   NoiSanXuatDAO noiSanXuatDAO = new NoiSanXuatDAO();
   NoiSanXuat nsx = noiSanXuatDAO.getNoiSanXuat(nsxMa);
   return JSonUtil.toJson(nsx);
   /*ArrayList<NoiSanXuat> nsxList = (ArrayList<NoiSanXuat>) new NoiSanXuatDAO().getAllNoiSanXuat();
   return toJson(nsxList);*/
 }
  @RequestMapping("/manageNsx")
  public ModelAndView manageNsx(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    NoiSanXuatDAO noiSanXuatDAO = new NoiSanXuatDAO();
    request.getCharacterEncoding();
    response.getCharacterEncoding();
    request.setCharacterEncoding("UTF-8");
    response.setCharacterEncoding("UTF-8");

    String action = request.getParameter("action");
    if ("AddNsx".equalsIgnoreCase(action)) {
      String nsxMa = request.getParameter("nsxMa");
      String nsxTen = request.getParameter("nsxTen");

      noiSanXuatDAO.addNoiSanXuat(new NoiSanXuat(nsxMa, nsxTen));
      ArrayList<NoiSanXuat> noiSanXuatList =
          (ArrayList<NoiSanXuat>) noiSanXuatDAO.getAllNoiSanXuat();
      return new ModelAndView("danh-muc-noi-san-xuat", "noiSanXuatList", noiSanXuatList);
    }
    if ("deleteNsx".equalsIgnoreCase(action)) {
      String[] idList = request.getParameterValues("nsxMa");
      for (String s : idList) {
        noiSanXuatDAO.deleteNoiSanXuat(noiSanXuatDAO.getNoiSanXuat(s));
      }

      ArrayList<NoiSanXuat> noiSanXuatList =
          (ArrayList<NoiSanXuat>) noiSanXuatDAO.getAllNoiSanXuat();
      return new ModelAndView("danh-muc-noi-san-xuat", "noiSanXuatList", noiSanXuatList);
    }
    if ("manageNsx".equalsIgnoreCase(action)) {
      ArrayList<NoiSanXuat> noiSanXuatList =
          (ArrayList<NoiSanXuat>) noiSanXuatDAO.getAllNoiSanXuat();
      return new ModelAndView("danh-muc-noi-san-xuat", "noiSanXuatList", noiSanXuatList);
    }
    return new ModelAndView("login");
  }