Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What you are doing wrong here is, you are trying to locate your <strong>jrxml</strong> file somewhere in web folder from your java class. This will definitely raise "File Not found error" at run time because of incorrect context path. You could simply do the following:-</p> <ol> <li>Make a folder named say "Jrxml" under your java classes package. Suppose java classes package is <strong>com.ejb.beans</strong>, make a folder <strong>com.ejb.beans.jrxml</strong>. </li> <li>Put all your <strong>jrxml</strong> files into this folder.</li> <li><p>In your java class, load the <strong>class loader</strong> and locate the <strong>jrxml</strong> by its name and you will easily access it. Here is the code:- </p> <p><code>ClassLoader classLoader = getClass().getClassLoader();</code> </p> <p><code>InputStream url = null;</code> </p> <p><code>url = classLoader.getResourceAsStream("Report.jrxml");</code> </p> <p>This url can be used to compile report as :-</p> <p><code>JasperReport jasperReport = JasperCompileManager.compileReport(url);</code></p></li> </ol> <p>To create the report output file, you could store it at some path in your application server. Set your server path in environment variable and extract it in your class at runtime like this :-</p> <p><code>String serverHomeDir = System.getProperty("server.home.dir");</code></p> <p><code>String reportDestination = serverHomeDir + "/domains/ReportOutput/report.html";</code></p> <pre><code>// now print report at reportDestination JasperExportManager.exportReportToHtmlFile(jasperPrint, reportDestination); </code></pre> <p>Your html file will be generated at the required destination, which you can easily read and render it, the way you want to, through your web page.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload