sulaiman2043 Posted June 10, 2010 Share Posted June 10, 2010 I have created a jasper report, when i run it from my java code it shows the blank page, no content is displayed tottaly blank. Below is my java code and jrxml file written in ireport. plz help//java code.JasperReport jasperReport; JasperPrint jasperPrint; JasperDesign jasperdesign; jasperdesign = JasperManager.loadXmlDesign("D:/DunyaFASWeb/Project/public_html/reports/report1.jrxml"); jasperReport = JasperCompileManager.compileReport(jasperdesign); //jasperReport = JasperCompileManager.compileReport("D:/DunyaFASWeb/Project/public_html/reports/CostCenter.jrxml"); jasperPrint = JasperFillManager.fillReport(jasperReport, null); //JasperExportManager.exportReportToHtmlFile(jasperPrint,getServletConfig().getServletContext().getRealPath("/reports/report1.jrxml")); JasperExportManager.exportReportToHtmlFile(jasperPrint,"D:/DunyaFASWeb/Project/public_html/reports/myReport.html");//jrxml<?xml version="1.0" encoding="UTF-8"?><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report3" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> <background> <band splitType="Stretch"/> </background> <title> <band height="79" splitType="Stretch"> <staticText> <reportElement x="151" y="24" width="257" height="55"/> <textElement> <font size="36" isBold="true"/> </textElement> <text><![CDATA[My Report]]></text> </staticText> </band> </title> <pageHeader> <band height="35" splitType="Stretch"/> </pageHeader> <columnHeader> <band height="61" splitType="Stretch"/> </columnHeader> <detail> <band height="125" splitType="Stretch"> <staticText> <reportElement x="104" y="0" width="285" height="91"/> <textElement> <font size="36" isBold="true"/> </textElement> <text><![CDATA[Muhammad Sulaiman Malik]]></text> </staticText> </band> </detail> <columnFooter> <band height="45" splitType="Stretch"/> </columnFooter> <pageFooter> <band height="54" splitType="Stretch"/> </pageFooter> <summary> <band height="42" splitType="Stretch"/> </summary></jasperReport> Link to comment Share on other sites More sharing options...
keithrbennett Posted June 11, 2010 Share Posted June 11, 2010 I don't have a specific answer for you, but I'm a beginner too, and I had the same problem. I fixed it by trying different values for the XPath strings for the data source and the report XPath queries. In my case, I had an outer XML element with various different elements inside, but not repeating items. I'm using iReport to design the report. In the data source text field labeled "Create data source using this expression", I specified /outerElementName (where "outerElementName" is whatever your outer element name is). Then in the report query dialog I specified XPath as the query language, and specified * as the query string. I have a subreport with repeating elements. For that one, I got it to work by specifying /outerElementName/repeatingElementName in the data source, and outerElementName/repeatingElementName (notice the absence of the leading slash) for the report query. This worked for me, but I'd be curious to know if there's a better way. Link to comment Share on other sites More sharing options...
sulaiman2043 Posted June 11, 2010 Author Share Posted June 11, 2010 As i have just created a sample report with no data to be displayed just a static text.....i was just filling the report like this....jasperPrint = JasperFillManager.fillReport(jasperReport, null);but as there is an empty datasource, i have supplied another parameter in it with empty datasource....jasperPrint = JasperFillManager.fillReport(jasperReport, null, new JREmptyDataSource());now it is working fine for me.. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now