Jump to content
We've recently updated our Privacy Statement, available here ×

Iceface 1.5 and jasperreports intergration


pawel_r

Recommended Posts

Hi

I am developing application, which was written in icefaces (1.5). I would like to add reporting functionality using jasperreports.

Unfortunatelly, after long search I haven't found satysfying solution till now.

The most popular way to integrate icefaces and jasperreport seems to be with ice:outputResource tag, as described in this thread:

http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=59388

Unfortunately, this tag comes with 1.7.2 version. The project, which I am working on, is already deployed and a lot stuff connected with icefaces was prepared to suit our needs. In other words -upgrading to newer version would be really time consuming.

When it comes to icefaces 1.5 I found a solution by adding javascript code, which calls from backing bean a new window (as in code below)

What I forgot to mention - I need to parametrize report, so passing all parameters in url brings security issues (reports have to be personalized depending on user rights).

I tried to simply generate report in backing bean. I put pdf content, generated by jasper egnine to outputstrem (Servlet output stream -see code below). Then I used method responseComplete() to make sure that no other output will be generated. This code worked fine with in java server faces, but when I started using icefaces it just hangs the page for a moment and there is no change to the view (everything works like there was no action).

 

I know it is more topic for icefaces forum, but I hope that someone had similar porblem and can help.

Code:
(Javascript call from backing bean, catched by servlet generating report)JavascriptContext.addJavascriptCall(fcontext,  "window.open (\"raport.jasper"+paramUrl+"\");"); (raport generated in backing bean)		FacesContext fcontext= FacesContext.getCurrentInstance();		ExternalContext context = fcontext.getExternalContext();		HttpServletResponse response = (HttpServletResponse)context.getResponse();(...)ServletOutputStream out = response.getOutputStream();				JasperReport jasperReport;				if(filename.endsWith("jrxml")){				JasperDesign jasperDesign = JRXmlLoader.load(reportStream);				jasperReport = JasperCompileManager.compileReport(jasperDesign);				jasperPrint = JasperFillManager.fillReport(jasperReport, parameters,connection);response.setContentType("application/pdf");					exporter = new JRPdfExporter();exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);				exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, out);				exporter.exportReport();				out.close();				fcontext.responseComplete();
Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

No solution, till now.

The one I presented above is really easy to hack (I mean not registered user can get access to those data - that's definitely not acceptible in commercial application). I hope someone has found a better solution (well, if really migration to newer version of icefaces is needed than I am also interested in such solution).

Till now I just get backing bean, which is geting the request from icefaces, but report is not generated :(

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...