Announcement Announcement Module
Collapse
No announcement yet.
Empty View using Jasper Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Empty View using Jasper

    Hi,

    I was struggling all day to find out the problem, but I found nothing.
    I'm using now Acegi, Spring MVC, and Jasper.

    And what I have, I want to pass the result of my searching in to the view, which invokes JasperReportsMultiFormatView.

    What I get is only an empty page for all formats, pdf, excel, and html.
    The JasperReportsMultiFormatView is invoked, because the application doesn't send any error, but like I said, it returns an empty pdf file, empty xls file, also empty html file.

    I tried with some jrxml files, which also work in another application. So I think the problem is not in jrxml file.

    Can somebody help me ?

    steve

  • #2
    Error exception in Jasper Spring

    Hi,

    I think, no one has the same problem as I.
    I just found the hidden error, so the view displays the pdf, xls or html without error. But the page is empty.

    And like I said, I tried all possibility. I tried also using another jrxml, which works in other page. It still displayed an empty page.
    I tried implement subclass from Jasper view class, didn't work.
    I checked the whole library, there was no problem.

    And I checked into the code, what I found. The code doesn't return any error if the page empty. And in may case I found the error in reportDataKey. This property accepts the data to be reported, but it doesn't proof whether the data ok or not.

    So I just used another constructor to to build the data
    //JRDataSource xmlDataSource = new JRXmlDataSource(docw3c, "/ino:response/xql:result/contract");
    JRDataSource xmlDataSource = new JRXmlDataSource(docw3c);
    And it works, I think the XPath that I'd given in JRXMLDataSource was wrong. But Spring doesn't return any error.

    I'll check in again and let you know.

    sjtirtha

    Comment


    • #3
      Same problem

      Hi sjtirtha

      I had exatcly same problem as you, thanks for your investigation. It works now

      Comment


      • #4
        I am using something like,

        InputStream fUECReportStream = getServletConfig().getServletContext()
        .getResourceAsStream("/reports/FUECReport.jasper");
        JRXmlDataSource xmlDataSource = new JRXmlDataSource(stringToDom(xmlResult));
        where xmlResult is an XML string which gets converted to DOM from stringToDom function.

        JasperRunManager.runReportToPdfStream(fUECReportSt ream,
        servletOutputStream, parameterMap, xmlDataSource);

        response.setContentType("application/pdf");
        servletOutputStream.flush();
        servletOutputStream.close();


        public static Document stringToDom(String xmlSource) throws SAXException, ParserConfigurationException, IOException {
        Document document = null;
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        document=builder.parse(new InputSource(new StringReader(xmlSource)));
        }
        The PDF gets opened, but I don't see any data?

        Is there any mistake somewhere?

        Comment

        Working...
        X