需要在jsp页面中显示文件夹的项目。没有错误但也没有输出 [英] Need to display items of a folder in jsp page. No error but no output also

查看:75
本文介绍了需要在jsp页面中显示文件夹的项目。没有错误但也没有输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在jsp页面中显示文件夹中存储的数据。这里我没有错误,也没有显示输出。



I want to display stored data from a folder in jsp page. Here I have no error nor output is displayed.

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <%@page import="java.io.File" %>
        <title>JSP Page</title>
    </head>
    <body>
 <form method="post" action="upload" enctype="multipart/form-data">
Select file to upload:
<input type="file" name="dataFile" id="fileChooser"/><br/><br/>
<input type="submit" value="Upload" />

<%
      String path = "C:/Users/Documents/NetBeansProjects/prac/build/web/data";

  String files;
  File folder = new File(path);
  File[] listOfFiles = folder.listFiles();

  for(int i = 0;i < listOfFiles.length;i++)
  {

   if (listOfFiles[i].isFile())
   {
   files = listOfFiles[i].getName();
       if (files.endsWith(".mp3") || files.endsWith(".mp3"))
       {
          System.out.println(files);
        }
     }
  }
    %>
</form>


    </body>
</html>

推荐答案



out.println而不是system.out.println
write
out.println instead of system.out.println


这篇关于需要在jsp页面中显示文件夹的项目。没有错误但也没有输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆