I am working on dynamic web project using Eclipse. I have created a report using Jaspersoft Studio. Now I am trying to access the same from my jsp
. But i am getting below error:
java.io.FileNotFoundException: /home/kavi/dev/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/inqc/Blank_A4_Landscape.jasper
Please snap shows my report location. But as per above error, those files are missing in above path. So please someone help to resolve this error.
How are you trying to access the file? Using java.io.File
?
Try using the absolute path, something like /home/kavi/dev/workspace/inqc/Blank_A4_Landscape.jasper
as opposed to navigating via the .metadata
folder and see if it works.
Update:
A sample jsp file that reads text from a .txt file and prints it.
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" import="java.io.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
String s = null;
try {
BufferedReader reader = new BufferedReader(new FileReader(new File("C:/Eclipse/workspace/Temp/sample.txt")));
s = reader.readLine();
} catch (Exception e) {
e.printStackTrace();
}
%>
<p>String is <%=s %></p>
</body>
</html>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.