我正在创建一个程序来读取存储在服务器上的文本文件。我可以读取文件并在控制台中以我想要的方式获取结果,但当我尝试在网页上显示它们时,得到的结果却完全不同。我在控制台上得到的结果是
Log File Path: the path is here
Input Directory: the input directory
Results Directory: the results directory
在我的网页上
Log File Path: the path is here
Log File Path: the path is here
Log File Path: the path is here
Input Directory: the input directory
Input Directory: the input directory
Input Directory: the input directory
Results Directory: the results directory
Results Directory: the results directory
Results Directory: the results directory
下面是我的代码:
<%
File file = new File("the file path");
BufferedReader br = new BufferedReader(new FileReader(file));
String st;
while((st = br.readLine()) !=null){
System.out.println(st);
%>
<form action="performMagic('<%=mr.getKey()%>')" method="post"
enctype="multipart/form-data">
Log File Path:<%=st%><br>
Input Directory:<%=st %><br>
Results Directory:<%=st %><br>
</form>
<br>
</ul>
<%
}
br.close();
%>
这和我的while循环有关,我不知道是什么问题。
1条答案
按热度按时间new9mtju1#
您的“br.close();”语句出现在while循环中。