Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to display stored data from a folder in jsp page. Here I have no error nor output is displayed.

XML
<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>
Posted

1 solution

write
out.println instead of system.out.println
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900