Foros de discusión

Display .jrxml file in jsp page

marzada paulc chowdhury, modificado hace 12 años.

Display .jrxml file in jsp page

New Member Mensajes: 9 Fecha de incorporación: 14/12/11 Mensajes recientes
Hi,

I am completely new to liferay.I have created .jrxml files using ireport of jasper report.Now i want to display this .jrxml file in a jsp.I am using the following code...
<form name='reportform' method='POST'>
<%
JasperDesign jasperDesign = JRXmlLoader.load("D:\\Liferay\\liferay-portal-6.0.6\\tomcat-6.0.29\\webapps\\ROOT");
JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
//Connection conn = new DBUtility().getConnection();
ByteArrayOutputStream baos =new ByteArrayOutputStream();
response.setContentType("application/pdf");
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, null);
net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfStream(jasperPrint,baos);
response.setContentLength(baos.size());
ServletOutputStream out1 = response.getOutputStream();
baos.writeTo(out1);
out1.flush();
System.out.println("the value of jasperReport:::"+jasperReport);
System.out.println("the value of jasperPrint:::"+jasperPrint);
//conn.close();
%>
</form>

Am I going in the correct direction.Can anyone suggest any code base or tutorial where all this things can be available.
thumbnail
Thiago Leão Moreira, modificado hace 12 años.

RE: Display .jrxml file in jsp page

Liferay Legend Mensajes: 1449 Fecha de incorporación: 10/10/07 Mensajes recientes
That is not the right way to do it. You should use the feature serveResource of portlets to serve data other than JSPs. Take a look how to use this feature at this blog entry Serving_Resources
thumbnail
Hitoshi Ozawa, modificado hace 12 años.

RE: Display .jrxml file in jsp page

Liferay Legend Mensajes: 7942 Fecha de incorporación: 24/03/10 Mensajes recientes
If you aren't to familar with portlet development and do not have too much time, then you can just setup your jsp in some application server and
display your jasper report pages using iframe portlet. You may not be able to use Liferay's permission routines using this method.

If you have some time and want to learn about portlet development, look at some codes and settings on the available Liferay portlets.