コード例 #1
0
  @RequestMapping("/edit_customer")
  public ModelAndView edit_customer(HttpServletRequest request) {
    int ID = Integer.parseInt(request.getParameter("userID"));

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

    Map<String, String> user = new HashMap<String, String>();

    CustomerDAO customerDAO = (CustomerDAO) context.getBean("customerDAO");

    user = customerDAO.findCurrentCustomerById(ID);

    IndustryDAO industryDAO = (IndustryDAO) context.getBean("industryDAO");
    List<Industry> industries = new ArrayList<Industry>();
    industries = industryDAO.getIndustriesList();

    ModelAndView model = new ModelAndView("edit_customer");
    model.addObject("userData", user);
    model.addObject("industryList", industries);
    /**
     * <c:forEach items="${countries}" var="country"> <option
     * value="${country.key}">${country.value}</option> </c:forEach>
     */
    return model;
  }