0

Closing window problem

asked 2014-10-28 17:41:46 +0800

rgravel gravatar image rgravel
28 5

updated 2014-11-03 16:53:00 +0800

Hi,

From a controller, I'm opening a new window to call a Jasper report. The problem it that new window (or tab depending of your browser) is blank when I choose an Excel format. I would like to close this window once the jasper/Excel is opened. How should I proceed to get the blank window closed? Or display teh Excel report in this new window?

Please note that for any other document type (PDF, HTML, etc.), the report is displayed in the new window/tab, which is ok.

Here's part of my code:

reports.java (controler)

Executions.getCurrent().sendRedirect("/app/rapport/displayReport.zul", "_blank");

displayReport.zul

<zk>
<jasperreport id="report" hflex="1" height="100%" width="100%"/>
<zscript><![CDATA[

        import org.cic.common.container.SessContext;
        import org.cic.fwd.ServiceLocator;
        import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;

        SessContext sessContext = ServiceLocator.getSessContext();   

        report.setSrc((String)sessContext.get("src"));
        report.setDatasource((JRBeanCollectionDataSource)sessContext.get("datasource"));
        report.setParameters((Map)sessContext.get("parameters"));
        report.setType((String)sessContext.get("type"));
]]></zscript>
</zk>
delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-10-29 01:55:24 +0800

cor3000 gravatar image cor3000
6280 2 7

I found this discussion. http://stackoverflow.com/questions/2085319/close-browser-popup-page-after-downloading-file seems like there is no such browser event one could listen to and react accordingly.

If you are sure the report will always trigger a download, then just include the <jasperreport/> component into a small div, as jasper report renders an iframe anyway.

link publish delete flag offensive edit
0

answered 2014-11-02 11:50:51 +0800

Darksu gravatar image Darksu
1991 1 4

Hello rgravel,

Could you please check the example at the following url:

http://www.zkoss.org/zkdemo/reporting/jasperreport

I believe you will find it very useful.

Best Regards,

Darksu

link publish delete flag offensive edit

Comments

That's the first place I looked. And the problem is the same on this demo. When you select any type of document, in displays in the white section below (in the same page), which is ok. But when you choose the "Excel" format, you'll see that the section below stays blank and a new Excel window opens. My problem is exactly the same but the difference is that I display the report in another window/tab instead of the same page. That's why I have a blank wnidow/tab instead of havinf (like the demo) a blank section in the same page.

rgravel ( 2014-11-03 16:49:46 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-10-28 17:41:46 +0800

Seen: 17 times

Last updated: Nov 03 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More