很郁闷啊,谁见过这个问题,没法贴图,愁死了

解决方案 »

  1.   

    public String scenicPicAdd() {
    if (null != img) {
    String small = "small_";
    String big = "big_";
    String fileType = new String();
    for (int l = 0; l < img.size();l++) {
    fileType = imgFileName.get(l).substring(
    imgFileName.get(l).lastIndexOf(".") + 1,
    imgFileName.get(l).length());
    String uploadPath = PathTool.getWebProjectPath() + savePath
    + "";
    String dbPath = savePath + "";
    SimpleDateFormat sim = new SimpleDateFormat("yyyymmddhhmmssSSS");
    String newname = sim.format(new Date()) + "." + fileType;
    File file = new File(fileType);
    if (!file.isDirectory()) {
    file.mkdirs();
    } try {
    SceneryPic sceneryPic = new SceneryPic();
    UpFile.saveFileByFileAndOutString(img.get(l), uploadPath
    + newname);
    UpFile.makeNewImage(uploadPath + newname, uploadPath + big
    + newname, 220, -10, fileType);
    UpFile.makeNewImage(uploadPath + newname, uploadPath
    + small + newname, 110, -10, fileType);
    sceneryPic.setMaxpic(dbPath + big + newname);
    sceneryPic.setMinpic(dbPath + small + newname);
    sceneryPic.setPic(dbPath + newname);
    Scenery scenery2 = sceneryService.findById(sid);
    sceneryPic.setScenery(scenery2);
    sceneryPicService.save(sceneryPic);
    return SUCCESS;
    } catch (Exception e) {
    e.printStackTrace();
    return ERROR;
    } } }
    return ERROR; }
      

  2.   

    变量为啥非要用l 这个和1长得太像了
    for (int l = 0; l < img.size();l++) { //img是个list?
      

  3.   

    是个List
    问题已经解决了,原来是我在处理时候无意间写了一个return 跳出循环了,所以那个l++没有执行,也就是死代码了,我还是太嫩了.......