예제 #1
0
  @RequestMapping(value = "/ad-editLocation/{id}", method = RequestMethod.POST)
  public String postEditLocation(
      @ModelAttribute("location") Location location,
      @PathVariable("id") int id,
      @RequestParam(value = "attachFile", required = false) List<CommonsMultipartFile> attachFile) {
    if (attachFile != null) {
      if (attachFile.isEmpty()) {
      } else {
        location.setGallery(imageCompressor.compress(attachFile, 800, 1000, true));
      }
    }

    locationService.save(location);
    return "redirect:/ad-searchLocation?editSuccess=true";
  }
예제 #2
0
  @RequestMapping(value = "/ad-addLocation", method = RequestMethod.POST)
  public String postAddLocation(
      @ModelAttribute("location") Location location,
      @RequestParam(value = "attachFile", required = false) List<CommonsMultipartFile> attachFile) {

    if (attachFile != null) {
      if (attachFile.isEmpty()) {
      } else {
        location.setGallery(imageCompressor.compress(attachFile, 800, 1000, true));
      }
    }

    System.out.println(location.getAddress());
    locationService.save(location);

    return "redirect:/ad-searchLocation?addSuccess=true";
  }