-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi guys,
I have a very strange problem with jasperreport.
I'm working on fedora 9, with jdk5.15 and zkoss3.0.4 (but the problem remains also with 3.0.6 and 3.0.7)
I have a window with this line
<jasperreport id="jr" visible="false"/>
Clicking on a button in this window, this code is called:
public void onStampa() { System.out.println("Start"); String[] cart = (String[])getNamespace().getVariable("datiCart", true); Date dallaData=(Date)getNamespace().getVariable("dallaData", true); SimpleDateFormat df=new SimpleDateFormat("MM/yyyy"); if (cart != null) { System.out.println("not null"); //print details for (int i = 0; i< cart.length; ++i) System.out.println(cart<i >); String body = ""; for (int i = 3; i< cart.length; ++i) body += cart<i > + "\n"; Cartolina c = new Cartolina(cart[0], cart[1], cart[2], body, df.format(dallaData)); ArrayList<Cartolina> coll = new ArrayList<Cartolina>(0); coll.add(c); JRDataSource ds = new JRBeanCollectionDataSource(coll); Jasperreport report = (Jasperreport)getFellow("jr"); report.setSrc("reports/cartolina.jasper"); report.setDatasource(ds); report.setType("pdf"); System.out.println("end"); } else ICHelper.Messaggia("Cartolina vuota"); }
at the end of this piece of code execution I have on the console:
Start
not null
//details
end
The code is executed from the beginning to the end, but nothing happens.
No window is opened to save or open a pdf file, no errors, nothing!
Can anybody help me?
Thanx
I'm sorry for the missing detail, it runs in java.
This is the page code:
<?xml version="1.0" encoding="UTF-8"?>
<window Title="Cartolina" id="wCartolina_${arg.wndId}" use="it.aliaslab.infocert.listener.CartolineUI" sizable="true" closable="true" border="normal" contentStyle="background:#F2F4F1; overflow:auto; position:relative" position="center,center" width="900px" height="600px"
xmlns:a="http://www.zkoss.org/2005/zk/annotation" >
<?init class="it.aliaslab.infocert.TestLogin"?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit"?>
<separator id="trg"/>
<separator />
<hbox>
<!-- label value="Intervallo per stampa dal" width="100px" /-->
<label value="Stampa dal" width="100px" />
<separator />
<datebox value="@{dallaData,load-when=trg.onFiltriChange}" width="80px" format="dd/MM/yyyy"/>
<separator />
<!-- label value="Al" width="50px" />
<separator />
<datebox value="@{allaData,load-when=trg.onFiltriChange}" width="80px" format="dd/MM/yyyy"/-->
<button label="Aggiorna" forward="onRicarica"/>
<button tooltip="Stampa" id="btnStampa" image="buttons/document-print.png" orient="vertical" width="30px" height="30px" visible="true" forward="onStampa"/>
</hbox>
<separator bar="true"/>
<grid width="98%" height="500px" model="@{datiCart,load-when=trg.onBeanListChange}">
<rows>
<row self="@{each=cart}">
<label pre="true" style="font-family:monospace; font-size:x-small" value="@{cart}" width="95%"/>
</row>
</rows>
</grid>
<jasperreport id="jr" visible="false"/>
<popup id="Stampa">
<hbox valign="middle">
<image src="buttons/QuestionMark.png"/>
<label value="Stampa cartoline"/>
</hbox>
</popup>
</window>
thanx
I'm sorry for this question, it has been a stupid error.
With the visible = false it is really difficult to see anything.
But now I have another problem, using firefox 3 (with IE all works fine) and this code
(function in Java, and not in zscript, called when I click a button in a window)
public void onStampa() { //fil the coll ArrayList JRDataSource ds = new JRBeanCollectionDataSource(coll); getDesktop().getSession().setAttribute("ds", ds); Window w = (Window)Executions.createComponents("reports/dipendenti.zul", null, null); try { w.doModal(); } catch (SuspendNotAllowedException e) { ICHelper.Messaggia("Impossibile aprire la finestra dipendenti.zul"); ICHelper.LoggaEccezione("Impossibile aprire la finestra dipendenti.zul", e); } catch (InterruptedException e) { ICHelper.Messaggia("Impossibile aprire la finestra dipendenti.zul"); ICHelper.LoggaEccezione("Impossibile aprire la finestra dipendenti.zul", e); } }
dipendenti.zul is simply
<?xml version="1.0" encoding="UTF-8"?> <window contentStyle="background:#F2F4F1; overflow:auto; position:relative" position="center,center" title="Dipendenti" closable="true" sizable="true" border="normal" height="580px" width="800px"> <jasperreport src="reports/dipendenti.jasper" datasource="${ds}"/> </window>
I see a blank window only for the first time after the application deploy(JBoss 4.2.2). Window resize let the pdf appears inside it.
Only for the first time, if I try again all goes well.
Furthermore, when I close dipendenti.zul I have this error:
15:57:00,817 ERROR Sep 18, 2008 3:57:00 PM org.zkoss.zk.au.http.AuDynaMediar process:135
SEVERE: Failed to load the media.
org.zkoss.zk.ui.ComponentNotFoundException: Component not found: z_pk_kh1
at org.zkoss.zk.ui.impl.DesktopImpl.getComponentByUuid(DesktopImpl.java:371)
at org.zkoss.zk.au.http.AuDynaMediar.process(AuDynaMediar.java:112)
at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:287)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Thread.java:595)
The code above is only an example. These probleme happen any time I use JR to obtain a PDF with firefox.
Any suggestion?
Asked: 2008-09-18 08:11:20 +0800
Seen: 622 times
Last updated: Sep 18 '08