Html-structure
<html><head></head><body>
<!-- START XOXO -->
"lots of html and jsp stuff"
<!-- STOP XOXO -->
"file reading"
</body>
</html>
The file reading code
<%@ page import="java.io.*" %>
<%
String line = "";
String file = request.getRequestURL().toString();
int print = 0;
BufferedReader input = new BufferedReader(new FileReader(file));
while ((line = input.readLine()) != null) {
if (print == 1) {
out.println(line);
}
if (line.equals("<!-- START XOXO -->")) { print = 1; }
else if (line.equals("<!--STOP XOXO -->")) { print = 0; }
}
input.close();
%>
Output
java.io.FileNotFoundException: http:/jsp-stud.idi.ntnu.no:8080/nicklau/oving4test.jsp
(No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at java.io.FileReader.<init>(FileReader.java:41)
at _nicklau._oving4test__jsp._jspService(/locals/web/folk/nicklau/oving4test.jsp:106)
at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
at com.caucho.jsp.Page.subservice(Page.java:486)
at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
at com.caucho.http.security.SecurityFilter.doFilter(SecurityFilter.java:115)
at com.caucho.server.http.FilterChainFilter.doFilter(FilterChainFilter.java:88)
at com.caucho.server.http.Invocation.service(Invocation.java:311)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:218)
at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:160)
at com.caucho.server.TcpConnection.run(TcpConnection.java:137)
at java.lang.Thread.run(Thread.java:534)
I just cant figure out why it cant find itself?