Beispiel #1
0
  @RequestMapping("/carEditRecord")
  public String editRecord(
      ModelMap model, HttpServletRequest request, HttpServletResponse response) {
    int id = Integer.parseInt(request.getParameter("id"));
    EditRecordDTO editRecordDTO = new EditRecordDTO();
    editRecordDTO.setNewFuel(new Fuel());
    editRecordDTO.setOldFuel(fuelDAO.getById(id));
    model.addAttribute("form", editRecordDTO);

    return "carEditRecord";
  }
Beispiel #2
0
  @RequestMapping("/editRecordResult")
  public String editRecordResult(
      ModelMap model, @ModelAttribute("editRecordDTO") EditRecordDTO editRecordDTO) {
    Fuel fuel = editRecordDTO.getNewFuel();
    fuelDAO.update(fuel);

    RecordsDTO recordDTO = new RecordsDTO();
    recordDTO.setRecords(fuelDAO.getAll());
    model.addAttribute("form", recordDTO);

    return "carRecords";
  }