下面的三个判断能不能用for循环简化一下
if (from1.getuploadfile1().getFileSize() != 0) {
System.out.println("1234");
str = com.getpicturename(from1.getuploadfile1(), path);
strpath.append(str + ",");
} if (from1.getuploadfile2().getFileSize() != 0) {
System.out.println("1234");
str = com.getpicturename(from1.getuploadfile2(), path);
strpath.append(str + ",");
} if (from1.getuploadfile3().getFileSize() != 0) {
System.out.println("1234");
str = com.getpicturename(from1.getuploadfile3(), path);
strpath.append(str + ",");
}
if (from1.getuploadfile1().getFileSize() != 0) {
System.out.println("1234");
str = com.getpicturename(from1.getuploadfile1(), path);
strpath.append(str + ",");
} if (from1.getuploadfile2().getFileSize() != 0) {
System.out.println("1234");
str = com.getpicturename(from1.getuploadfile2(), path);
strpath.append(str + ",");
} if (from1.getuploadfile3().getFileSize() != 0) {
System.out.println("1234");
str = com.getpicturename(from1.getuploadfile3(), path);
strpath.append(str + ",");
}
解决方案 »
- 弱弱问下,学习Java开发,对XML掌握何种程度
- 晕!好奇怪的语法!
- DWR与Spring整合!提出一个小问题!格式清楚!在线急等!
- 初学java,问两个问题,急。。。。。(散分100)
- 高分求关于oracle的blob字段操作的长度限制问题??
- jtable的刷新问题
- 急:java包提供的几个api函数怎么公用一个网络连接?先给100分,解决了重分酬谢!
- JAVA,JOpitonPane基础问题...输出问题?
- (毕业设计呀,好惨!)两个JBulider应用程序(未打包)之间互相传递信息(比如说用户名,用户密码,登陆日期等等),除了用Socket,还有其他方法吗?(
- 求解类方法
- 有一道AWT的题,解不出,郁闷
- 为什么我用import org.dom4j.Document;它报错呢?我用的是MyEclipes
设计成getuploadfile(parameter), 也许这个地方就会很简洁。令,不知道java中有没有类似javascript的eval,呵呵。
for(int i=0;i<3;i++)
{
if (uploadfile[i].getFileSize()!= 0) {
System.out.println("1234");
str = com.getpicturename(file[i], path);
strpath.append(str + ",");
}
}
只是个思路,我写的不一定对。