Пример #1
0
  public String showDelete() {
    Seller seller = (Seller) getSession().getAttribute(FrontContainer.SELLER_INFO);
    if (seller == null || StringUtils.isBlank(seller.getOwner_mobile())) {
      return "toLogin";
    }
    String imgId = getRequest().getParameter("e.id");

    //        String picture = getRequest().getParameter("e.show_img");
    //        String order1 = getRequest().getParameter("e.order1");
    IndexImg indexImg1 = indexImgService.selectById(imgId);
    String picture = indexImg1.getPicture();
    // indexImg1.setPicture(picture);

    // indexImg1.setOwner_id(seller.getId());
    indexImgService.delete(indexImg1);
    // String realPath= ServletActionContext.getServletContext().getRealPath("/");
    String path = ServletActionContext.getServletContext().getRealPath("/") + picture;
    if (StringUtils.isNotBlank(path)) {
      // path = pDir + path;
      File file = new File(path);

      if (file.exists()) {
        deleteFile(file);
        // getResponse().getWriter().write("succeed");
      }
    }
    IndexImg indexImg2 = new IndexImg();
    indexImg2.setOwner_id(seller.getId());
    indexImgs = indexImgService.selectList(indexImg2);
    indexImgSize = indexImgs.size();
    selectLeftMenu = "show";
    e = sellerService.selectById(seller.getId());
    setSelectMenu(FrontContainer.not_select_menu); // 设置主菜单为不选中
    return show();
  }