Want to display file list using jsp

前端 未结 2 1966
北恋
北恋 2021-01-16 17:43

I am new to netbeans with glassfish server.My html code looks like,


    
2条回答
  •  生来不讨喜
    2021-01-16 18:22

    you can do like that

         <%!
          Object path;
          public void getDirectory(String path, Vector files, Vector folder){
          File directory=new File(path); 
         File []file=directory.listFiles();
            for(int i=0; i
    
    
    <%
    
        path=session.getAttribute("fileName");
       Vector file=new Vector(), folder=new Vector();
      getDirectory("C:/FileFolderProject/WebContent/"+path,file,folder);
       out.println("");
    
      for(int a=0; a
         
      <%
    
      }
      out.println("");
      %>
       
    file <% out.println(""+file.elementAt(a).toString()+"
    "); %>

提交回复
热议问题