示例#1
0
  @Scope("session")
  @RequestMapping(value = "/delete_customer", method = RequestMethod.GET)
  public String deleteCustomer(Locale locale, Model model, HttpServletRequest request) {

    try {

      ApplicationContext context = new ClassPathXmlApplicationContext("Spring-Module.xml");
      CustomerDAO customerDAO = (CustomerDAO) context.getBean("customerDAO");

      int ID = Integer.parseInt(request.getParameter("id"));
      System.out.println(ID);
      /*String name = request.getParameter("name").toString();
      int age = Integer.parseInt(request.getParameter("age"));

      Customer user = new Customer(ID, name, age);*/
      customerDAO.delete(ID);

    } catch (Throwable q) {

    }
    return "redirect:/humans";
  }