首页|操作系统|软件开发|网页制作|媒体动画|数据库|ASP教程|ASP.NET教程|PHP教程|JSP教程|XML教程|建站资料|软件学院|行业资讯|平面设计|网络安全|晒IT论坛|IT人才
  位置: 晒IT >> JSP教程 >> JSP高级教程 >> 正文
 
 
文件夹下目录文件的迭代现实示例2
文件夹下目录文件的迭代现实示例2
 
 
package math;
import java.io.*;

public class Test {
    public static String List(File f) {
        String optionStr = null;
        String tempStr = null;
        String cc2 = f.getPath().toString();
        //System.out.println(cc2);
        optionStr = "<option >" + cc2 + "</option>";
        String[] name = f.list();
        for (int i = 0; i < name.length; i++) {
            File n = new File(f, name[i]);
            if (n.isDirectory())
                tempStr = List(n);
            if (tempStr == null) {
                tempStr = " ";
            }

            String cc1 = f.getParent().toString();
            String cc = f.getPath().toString();
            if (cc != cc2) {
                //System.out.println(f.getPath());
            }
            optionStr = optionStr + tempStr;
        }
        return optionStr;
    }

    public static void main(String[] s) {
        System.out.println(
            List(
                new File("D:\\ea\\wlserver6.0\\config\\WLSD11\\applications\\LabsWebApp")));
    }
}
  • 上一篇: Struts源码研究 - Action-Input属性篇
  • 下一篇: 文件夹下目录文件的迭代现实示例1
  •  告诉好友  打印此文 关闭窗口 返回顶部
     
    热点文章
     
     
    推荐文章
     
     
    相关文章

    | 设为首页 | 加入收藏 | 联系我们 | 友情链接 | 诚聘英才 |
    Copyright© 2008 ShaiIT.Com .All Rights Reserved
    下载alexa工具,提升您的网站排名