for循环中的x++出黄线,也就是无效,这个情况谁见过啊 很郁闷啊,谁见过这个问题,没法贴图,愁死了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 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; } 变量为啥非要用l 这个和1长得太像了for (int l = 0; l < img.size();l++) { //img是个list? 是个List问题已经解决了,原来是我在处理时候无意间写了一个return 跳出循环了,所以那个l++没有执行,也就是死代码了,我还是太嫩了....... jsp 选择一个id后怎么自动选择name 请教 如何将js的值无刷新传递给当前的jsp页面 这道题应该如何来做?求前辈帮解答下。 解析XML和从数据库读取哪个更快,有人测试过吗? 请问PowerDesigner中PDM如何定义外键?附例子 为什么图片无法显示..????急救 小弟想问一哪里有申请支持jsp的空间啊? 一个超奇怪的问题 spring最重要的两个特性? 怎么破豆瓣的反爬,还该怎么伪装爬虫 java类型错误java.lang.Integer cannot be cast to java.lang.String Java调固定Wsdl 代码
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; }
for (int l = 0; l < img.size();l++) { //img是个list?
问题已经解决了,原来是我在处理时候无意间写了一个return 跳出循环了,所以那个l++没有执行,也就是死代码了,我还是太嫩了.......