Example #1
0
 @RequestMapping("/carRecords")
 public String records(ModelMap model) {
   RecordsDTO recordDTO = new RecordsDTO();
   recordDTO.setRecords(fuelDAO.getAll());
   model.addAttribute("form", recordDTO);
   return "carRecords";
 }
Example #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";
  }
Example #3
0
  @RequestMapping("/carRemoveRecord")
  public String removeRecord(
      ModelMap model, HttpServletRequest request, HttpServletResponse response) {
    int id = Integer.parseInt(request.getParameter("id"));
    fuelDAO.removeById(id);

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

    return "carRecords";
  }