Issue with HTML export

Help
Jesus A
2010-02-03
2012-10-10
  • Jesus A

    Jesus A - 2010-02-03

    Hi
    I hope you can help me: I'm using the jasper report plugin with something like
    this:

    <jr:report path="classpath:report6.jasper" format="html" width="800px" height="1000px">
    <f:attribute name="IMAGES_URI" value="image?image="/>
    <jr:dataSource id="jndiDataSource" <br="">value="java:comp/env/jdbc/liberty"
    type="jndi"/>
    </jr:report>

    The .jasper template works great when exporting to HTML using iReport (the
    template is generated with it), but in my web app, the plugin exporter does
    something wrong and a lot of "null">" appear everywhere. The problem is the
    generated code:
    Code generated within iReport:



    Pepe


    Code generated within my web app using the plugin:



    null">Pepe


    I hope you can help me with this as it's urgent :(

     
  • Alonso Dominguez

    Hi asmartkid,

    Users are having some troubles when exporting reports which have linked
    resources. A patch request has been added (https://sourceforge.net/tracker/?f
    unc=detail&aid=2945905&group_id=212447&atid=1021787)
    to deal with
    them.

    About your urgent problem, unfortunately, there is not any quick solution for
    this but maybe you can workaround it. First of all, you'll need to download
    the last sources from the SVN repository and comment out following lines:

    net.sf.jasperreports.jsf.AbstractJRExporter:

    final JRHyperlinkProducerFactory hpf = new FacesHyperlinkProducerFactory(context, getComponent());
            exporter.setParameter(
                    JRExporterParameter.HYPERLINK_PRODUCER_FACTORY, hpf);
    

    This will prevent the double rendering of the anchors just before the "span".

    About the "IMAGE_URI" issue: this is still an unsupported attribute, plugin
    implementation can recognize it and bypass it to the JasperReports engine but
    it's not fully implemented. JasperReports uses and internal "FileResolver"
    interface to locate resources, plugin impl of that interface resolves
    resources using the built-in mechanism of the library (this needs to be
    enhanced) but currently there is no way to establish a relative "IMAGE_URI"
    and get the correct URL. If you are in a hurry, try to copy your images to a
    folder inside your web application and use the "IMAGE_DIR_NAME" attribute to
    reference them, that should work.

    If this can satisfy you, please, post some samples about your report and how
    those images are being used to help dealing with the "partial URI use case".

    Regards,
    Alonso

     
  • Jeff Headley

    Jeff Headley - 2010-02-16

    I am having a similar issue with html like this:

    <a href="%3Ca%20href=" null="" target="">null</a>
    "&gt;
    <span style="font-family: 'DejaVu Sans',Arial,Helvetica,sans-serif; font-size: 12px; font-weight: bold;">Users Report</span>
    

    But I don't believe I have any linked resources in my report as far as I can
    tell. I didn't choose any template or images. I'm using jasper reports/iReport
    3.7.1. Here is the full xml for the very simple report I made in iReport. If
    someone can tell how to remove those linked resources so that the report is
    viewed properly that would be great.

    <?xml version="1.0" encoding="UTF-8"?>
    <jasperReport xmlns="[url]http://jasperreports.sourceforge.net/jasperreports[/url]" xmlns:xsi="[url]http://www.w3.org/2001/XMLSchema-instance[/url]" xsi:schemaLocation="[url]http://jasperreports.sourceforge.net/jasperreports[/url] [url]http://jasperreports.sourceforge.net/xsd/jasperreport.xsd[/url]" name="usersDetail" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" whenResourceMissingType="Error">
        <property name="ireport.zoom" value="1.0"/>
        <property name="ireport.x" value="0"/>
        <property name="ireport.y" value="0"/>
        <property name="net.sf.jasperreports.export.html.using.images.to.align" value="false"/>
        <queryString language="SQL">
            <![CDATA[select ua.user_account_id, ua.enabled, ua.username,
    pn.firstname, pn.lastname
    from user_account ua, person p, person_name pn
    where ua.person_id = p.actor_id and pn.actor_id = p.actor_id]]>
        </queryString>
        <field name="USER_ACCOUNT_ID" class="java.math.BigDecimal">
            <fieldDescription><![CDATA[This is the user's account number]]></fieldDescription>
        </field>
        <field name="ENABLED" class="java.math.BigDecimal">
            <fieldDescription><![CDATA[1 means the user is enabled and 0 means disabled]]></fieldDescription>
        </field>
        <field name="USERNAME" class="java.lang.String">
            <fieldDescription><![CDATA[]]></fieldDescription>
        </field>
        <field name="FIRSTNAME" class="java.lang.String">
            <fieldDescription><![CDATA[]]></fieldDescription>
        </field>
        <field name="LASTNAME" class="java.lang.String">
            <fieldDescription><![CDATA[]]></fieldDescription>
        </field>
        <background>
            <band splitType="Stretch"/>
        </background>
        <title>
            <band height="79" splitType="Stretch">
                <staticText>
                    <reportElement x="0" y="14" width="802" height="20"/>
                    <textElement textAlignment="Center" markup="none">
                        <font size="16" isBold="true"/>
                    </textElement>
                    <text><![CDATA[CLASSoft]]></text>
                </staticText>
                <staticText>
                    <reportElement x="0" y="47" width="802" height="20"/>
                    <textElement textAlignment="Center" markup="none">
                        <font size="12" isBold="true"/>
                    </textElement>
                    <text><![CDATA[Users Report]]></text>
                </staticText>
            </band>
        </title>
        <pageHeader>
            <band height="35" splitType="Stretch"/>
        </pageHeader>
        <columnHeader>
            <band height="39" splitType="Stretch">
                <staticText>
                    <reportElement x="0" y="10" width="100" height="20"/>
                    <textElement/>
                    <text><![CDATA[ID]]></text>
                </staticText>
                <staticText>
                    <reportElement x="223" y="10" width="100" height="20"/>
                    <textElement markup="none"/>
                    <text><![CDATA[USERNAME]]></text>
                </staticText>
                <staticText>
                    <reportElement x="335" y="10" width="100" height="20"/>
                    <textElement markup="none"/>
                    <text><![CDATA[FIRST NAME]]></text>
                </staticText>
                <staticText>
                    <reportElement x="110" y="10" width="100" height="20"/>
                    <textElement markup="none"/>
                    <text><![CDATA[ENABLED]]></text>
                </staticText>
                <staticText>
                    <reportElement x="450" y="10" width="100" height="20"/>
                    <textElement markup="none"/>
                    <text><![CDATA[LAST NAME]]></text>
                </staticText>
            </band>
        </columnHeader>
        <detail>
            <band height="34" splitType="Stretch">
                <textField>
                    <reportElement x="0" y="6" width="100" height="20"/>
                    <textElement/>
                    <textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{USER_ACCOUNT_ID}]]></textFieldExpression>
                </textField>
                <textField>
                    <reportElement x="110" y="6" width="100" height="20"/>
                    <textElement/>
                    <textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{ENABLED}]]></textFieldExpression>
                </textField>
                <textField>
                    <reportElement x="223" y="6" width="100" height="20"/>
                    <textElement/>
                    <textFieldExpression class="java.lang.String"><![CDATA[$F{USERNAME}]]></textFieldExpression>
                </textField>
                <textField>
                    <reportElement x="335" y="6" width="100" height="20"/>
                    <textElement/>
                    <textFieldExpression class="java.lang.String"><![CDATA[$F{FIRSTNAME}]]></textFieldExpression>
                </textField>
                <textField>
                    <reportElement x="450" y="6" width="100" height="20"/>
                    <textElement/>
                    <textFieldExpression class="java.lang.String"><![CDATA[$F{LASTNAME}]]></textFieldExpression>
                </textField>
            </band>
        </detail>
        <columnFooter>
            <band height="45" splitType="Stretch"/>
        </columnFooter>
        <pageFooter>
            <band height="54" splitType="Stretch"/>
        </pageFooter>
        <summary>
            <band height="42" splitType="Stretch"/>
        </summary>
    </jasperReport>
    
     
  • Anonymous - 2010-02-17

    yes, It's strange, I also didn't incluse any kind of link in the report
    design.

     
  • Jesus A

    Jesus A - 2010-02-17

    ^^^^ Above message is from me, the original poster, i fear google accounts
    don't work well with sourceforge yet..
    By the way, I also used iReport 3.7.1

     
  • Alonso Dominguez

    Maybe JasperReports is trying to output any kind of "anchors" that could be
    clicked on to navigate through the different sections. Does that "a" element
    appear even after disabling the "FacesHyperlinkProducerFactory" ? What happens
    when you try to export to a different format?

     
  • Jeff Headley

    Jeff Headley - 2010-02-17

    Your suggested work around does work fine for me. I got the latest from svn,
    commented out the code, and it displays fine now. The other exporters always
    worked fine for me. PDF, Excel, and Word were ok. It appeared to be putting
    invalid hyperlinks on every element in the html version of the report. Title,
    sub-title, column headers, field elements, etc. The html and xhtml exporters
    from the iReport tool both exported the report correctly for me.

     
  • suresh kumar t

    suresh kumar t - 2012-06-01

    Hi,
    I have taken latest version (jasperreports-jsf-1.0- beta-4.jar) and same above
    problem i am getting like unwanted image tags are displayed on the html
    report.

    Please let me know which version i need to take for getting proper html format
    reports.

    regards,
    suresh

     
  • Alonso Dominguez

    Try to do as follows:
    - Design and compile the report using iReport. Additionally, do a preview of the HTML report in iReport
    - Go the folder iReport uses locally to generate the html and copy all generated files (except the HTML report itself) to a folder inside your web application.
    - Test the report generation from your web application.

    This has proven to work in some cases. Any feedback is welcome.

     
  • suresh kumar t

    suresh kumar t - 2012-06-04

    I followed above mentioned steps but same problem i am getting like junk tags
    are getting on the html report.

    Please let me know your feedback on this.

    regards,
    suresh

     
  • Alonso Dominguez

    yeah, I know, this has been an issue from the first versions of the plugin and
    I expect to have it fixed for once in the next release, anyway, let's see if
    we can find a workaround for this, here are some clues:

    When exporting to HTML, JasperReports generates blank images "on the fly"
    linked to the generated report and intended to be used by the latter to define
    document margins. This is useful with HTML as it allows the report to have the
    same layout with different screen resolutions. The problem is... to be so
    useful in a web application, that application need to provide with those
    images and the JasperReports engine must generate URL's that can resolve that
    specific resources, something that, obviously, is not happening at the moment.

    The fix consists on the plugin library providing with those resources and
    plugs a mechanism into JasperReports engine to detect when those URLs are
    generated and overriding the default behaviour with Faces' friendly one.

    The workaround, as I already told you, usually consists on generating those
    resources with iReport, copy all of them to the folder that contains the
    report (all but the generated HTML itself, as it should be re-generated by the
    engine when the application is running).

    If this isn't working for you at the moment, there should be some bug with URL
    generation, could you please post here the generated HTML for your report so I
    can check it out? I might be able to write a patch for that...

    Alonso

     
  • suresh kumar t

    suresh kumar t - 2012-06-05

    Hi,
    I am able to generate proper html report from ireport but from jsf plugin
    below code is generated.
    <html>
    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
    <style type="text/css">
    a {text-decoration: none}
    </style>
    </head>
    <body text="#000000" link="#000000" alink="#000000" vlink="#000000">


     








































































    manufacturer

    model

    color

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">13d56e96

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">Volvo

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">Brown

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">3ad904a9

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">BMW

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">Maroon

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">71d86374

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">Chrysler

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">Yellow

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">a8a295cd

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">Volvo

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">Green






















































































    manufacturer

    model

    color

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">45471cce

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">Volkswagen

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">Brown

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">5bd8036c

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">Volvo

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">Red

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">7747cdee

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">Volvo

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">Black

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">98ae5c7c

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">BMW

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">Black

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">caba9cb2

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">Ferrari

    <span
    style="font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif; color:

    000000; font-size: 10px;">Brown


     

    </body>
    </html>

    please give your feedback on this.

     
  • Alonso Dominguez

    right, it's pretty clear that the URL generation mechanism is not working
    properly at all. It will take a while until I have the patch. I know that this
    might be a lot of hassle but... have you tried to do the modifications to
    plugin's sources suggested in the second post of this thread?

     
  • suresh kumar t

    suresh kumar t - 2012-06-05

    Present i am using latest version (jasperreports-jsf-1.0- beta-4.jar) and that
    mentioned class is not available in this latest version plugin source.

    regards,
    suresh

     
  • Alonso Dominguez

    it has been replaced by "net.sf.jasperreports.jsf.engine.export.ExporterBase"

     
  • suresh kumar t

    suresh kumar t - 2012-06-06

    I have seen net.sf.jasperreports.jsf.engine.export.ExporterBase package and
    mentioned class but i am getting compilation error for few classes, Please let
    me know what are dependent jars required for this.

    regards,
    suresh

     
  • Alonso Dominguez

    You must configure a Maven profile with JBoss public repositories, my
    suggestion is to do so in your "settings.xml" file. After this Maven should be
    able to fetch all dependencies from the repositories.

    P.S.: You should work with the code tagged as "1.0-beta-4" in the SVN
    repository rather than the one in the trunk.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks