Java web project – how to serve html file sitting on desktop with images

Questions:

I’m working with something called JasperReports, and in my servlet, there’s this piece of code:

JasperExportManager.exportReportToHtmlFile(jasperprintobject,"C:UsersuserDesktopreportsmyreport.html");

This creates an html file called myreport.html in the reports folder on my desktop, and it also creates a folder called myreport.html_files containing images that myreport.html points to, also inside the reports folder.

I would like to serve this content to the user.

Unfortunately, it seems that the exportReportToHtmlFile method won’t let me put the html file inside WEB-INF.

If I could, I would just do:

request.getRequestDispatcher("/WEB-INF/myreport.html").forward(request,response);

I’m thinking about creating a jsp page that can somehow include the html file inside it and forwarding the user to the jsp page, but I’m not sure how to do this.

This is a dynamic web project in eclipse and I’m using tomcat 8.5

Does anybody have any ideas?

Thanks.

Answers:



Questions:

I’m working with something called JasperReports, and in my servlet, there’s this piece of code:

JasperExportManager.exportReportToHtmlFile(jasperprintobject,"C:UsersuserDesktopreportsmyreport.html");

This creates an html file called myreport.html in the reports folder on my desktop, and it also creates a folder called myreport.html_files containing images that myreport.html points to, also inside the reports folder.

I would like to serve this content to the user.

Unfortunately, it seems that the exportReportToHtmlFile method won’t let me put the html file inside WEB-INF.

If I could, I would just do:

request.getRequestDispatcher("/WEB-INF/myreport.html").forward(request,response);

I’m thinking about creating a jsp page that can somehow include the html file inside it and forwarding the user to the jsp page, but I’m not sure how to do this.

This is a dynamic web project in eclipse and I’m using tomcat 8.5

Does anybody have any ideas?

Thanks.

Answers:



Need Help? Chat with us