Include the content of a file in JSP -
I would like to include the content of a file inside the JSP page Usually, I will use something like this: < / P>
& lt; Jsp: include page = "& lt;% = path_to_file%> & gt; / & Gt; However, this will not work here because I am trying to include the file that is outside the web deployment.
The worst solution I've seen is something like this:
& Lt;% BufferedReader br = new BufferedReader (new FileReader (new file (path_to_file)); String line = br.readLine (); While (line! = Null) {%> & Lt;% out.println (line); & Gt%; & Lt;% line = br.readLine (); }% & Gt; & Lt; / TD & gt; & Lt;%} Catch (IOE Option E) {%> & Lt; TD & gt; & Lt;% = e% & gt; & Lt; / TD & gt; & Lt;%}% & gt; But I do not want to do actually do that.
Thanks
You point to your external path You can include symbolic paths in your distribution.
Comments
Post a Comment