1
This is the following I created the report in jasperReport I created a parameter there ,with that the data from this report it is taking from the database (Mysql) and displaying the/
But when I put to display in my JSF page the data is blank a blank pdf format .. Follows my code
In the apache server console ,displays this message ...
Caused by: java.net.Malformedurlexception
public RelatorioBean() {
this.context = FacesContext.getCurrentInstance();
this.response = (HttpServletResponse) context.getExternalContext().getResponse();
}
public void exporterPdf() {
stream = this.getClass().getResourceAsStream("/Ireport/ireport_1.jrxml");
Map<String,Object> params = new HashMap<String,Object>();
params.put("cpf_Funcionario",params);
params.put("invoice_logo",params);
baos = new ByteArrayOutputStream();
try {
JasperReport report = JasperCompileManager.compileReport(this.getClass().getResourceAsStream("/Ireport/ireport_1.jrxml" ));
JasperPrint print = JasperFillManager.fillReport(report,params, Conexao.getConexao());
JasperExportManager.exportReportToPdfStream(print, baos);
JasperViewer view = new JasperViewer(print,false);
view.setExtendedState(JasperViewer.MAXIMIZED_BOTH);
view.setVisible(true);
response.reset();
response.setContentType("application/pdf");
response.setContentLength(baos.size());
//attachment
response.setHeader("Content-disposition","inline;filename=ireport.pdf");
response.getOutputStream().write(baos.toByteArray());
response.getOutputStream().flush();
response.getOutputStream().close();
context.responseComplete();
} catch (JRException ex) {
Logger.getLogger(RelatorioBean.class.getName()).log(Level.SEVERE, null, ex);
JOptionPane.showMessageDialog(null, "Falha ao exportar: " + ex.getMessage(), "Erro", JOptionPane.ERROR_MESSAGE);
} catch (IOException ex) {
Logger.getLogger(RelatorioBean.class.getName()).log(Level.SEVERE, null, ex);
JOptionPane.showMessageDialog(null, "Falha ao exportar: " + ex.getMessage(), "Erro", JOptionPane.ERROR_MESSAGE);
}
I’d like your advice, please !!
in the params.put lines("cpf_Functioning" I’ve been searching .. are parameters .. there from Jasper and such.. and the invoice_logo was because apache was giving an error tbm on it.. there has been ,about an image of the report, guy already tested everything...
– Ricardo Mendes
I removed the code from the first line. e tbm retirei params.put (invoice_log), even so the message of - _italic java.net.Malformedurlexception
– Ricardo Mendes
someone to help me ??
– Ricardo Mendes
hey guys.. I’m following a tutorial to export my report , and I don’t understand why it keeps giving error -- in this excerpt

 String Caminho = Faces.getRealPath("default/ireport.jasper");
– Ricardo Mendes
The parameters should be of the Map type. You can get a good reference by following the explanations of David Buzzato here: Working with Ireport
– Silva Júnior