Ejemplo n.º 1
0
  /*
   * (non-Javadoc)
   *
   * @see
   * com.volvo.ea.controllers.CRUDController#update(javax.servlet.http
   * .HttpServletRequest, org.springframework.ui.ModelMap)
   */
  @Override
  @RequestMapping(value = "/update", method = RequestMethod.POST)
  public ModelAndView update(HttpServletRequest request, ModelMap model) {

    VolvoEntity entity;
    try {
      entity = volvoDAO.read(KeyFactory.stringToKey(request.getParameter("key")));
      entity = populate(request, entity);
      volvoDAO.update(entity);
    } catch (Throwable e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    // return to list
    return new ModelAndView("redirect:read");
  }
Ejemplo n.º 2
0
  /*
   * (non-Javadoc)
   *
   * @see
   * com.volvo.ea.controllers.CRUDController#create(org.springframework
   * .ui.ModelMap)
   */
  @Override
  @RequestMapping(value = "/create", method = RequestMethod.POST)
  public ModelAndView create(HttpServletRequest request, ModelMap model) {

    VolvoEntity entity = populate(request, null);

    try {
      volvoDAO.create(entity);
    } catch (Throwable e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    return new ModelAndView("redirect:read");
  }