日期:2014-05-18  浏览次数:20755 次

当上传三个图片的时候,为什么输出的第一个图片的描述是"上传"
JSP页面中:三个上传图片:file1,file2,file3和三个关于图片的描述加一个名为上传的SUBMIT按钮.
Servlet中运行
for(int   i=1;fileenum.hasMoreElements();i++){
String   name=(String)fileenum.nextElement();
String   dc=(String)filesdc.nextElement();
String   FileName=mpr.getFilesystemName(name);
String   ContentType=mpr.getContentType(name);
String   Description=mpr.getParameter(dc);
if(FileName!=null)
                out.println( " <font   color= 'red '> 您上传的 "+
"文件名称为: "+FileName+
" <br> 文件类型为: "+ContentType+
" <br> 文件的描述: "+Description+
" <br> <br> ");
}
当上传三个图片的时候,为什么输出的第一个图片的描述是 "上传 "(该描述我是随便写了一些字母)???????????

------解决方案--------------------
1. in the for loop, you never use the i index property, why not changing to while clause
2. check how many file and file description fields in your jsp file. Normally you should assing one file description for one file (one to one).
------解决方案--------------------
上传可以用smartUpload,也可以用strtus的formfile
------解决方案--------------------
描述别乱写,用有序的数字1,2,3去写,看看是不是对应次序窜了
------解决方案--------------------
关注