I would like to include the contents of the file in a JSP page. Normally I would use something like:
<jsp:include page="<%= path_to_file %>" />
However, this will not work here, because the file I'm trying to include is outside of the web deployment.
The ugliest solution I've seen looks something like this:
<td>
<% BufferedReader br = new BufferedReader(new FileReader(new File(path_to_file)));
String line = br.readLine();
while (line != null) { %>
<% out.println(line); %>
<% line = br.readLine(); } %>
</td>
<% } catch (IOException e) { %>
<td>
<%= e %>
</td>
<% } %>
But I really don't want to do this.
thanks
source
share