1 2 Previous Next 21 Replies Latest reply on Jan 18, 2011 11:53 AM by vata2999 Go to original post
      • 15. Re: Seam with JSF and Jasper Reports
        giomiano

        That are not funny characters, that is your report (try to save as pdf and open it)



        Using h:commandButton worked, quite normal, is it ? :)
        Check how a4j action is rendered and check how normal post is rendered :)



        • 16. Re: Seam with JSF and Jasper Reports
          rfcmahesh

          Thanks Tasneem. h:commandButton Works.

          • 17. Re: Seam with JSF and Jasper Reports
            cleitonash
            Hi.

            I don't known where I have to put the jasper files (report.jrxml). I've tried to put it into "WEB-INF/reports" at the .war file that is into the .ear file, but when I use the code below to get an Inputstream of the report, the input stream returned is null.
            ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();
            String path = servletContext.getRealPath("WEB-INF/reports/").replace("./", "");
            String file = "/report.jrxml";
            I've tried to use this code below too, but the result is the same...
            InputStream reportTemplate = this.getClass().getClassLoader().getResourceAsStream("RelatorioTeste.jrxml");

            The path + file string is
            /home/cleitonash/java/jboss-4.2.3.GA/server/default/tmp/deploy/tmp7470986768939011299jboss-seam-itext.ear-contents/jboss-seam-itext-exp.war/WEB-INF/reports/report.jrxml

            What I'm doing wrong ?
            Thanks...
            • 18. Re: Seam with JSF and Jasper Reports
              andre1001

              This is how I've got .ear after some changes to run JasperReports (3.6.0) with Seam (2.2.0):


              .ear
              -- lib
              ---- groovy-all-1.5.5.jar
              ---- jasperreports-3.6.0.jar (with Maven, exclude xml-apis.jar)
              -- .jar
              ---- ReportTest.jasper
              ---- action (java source)
              -- .war


              My action access the resource like said above:


              JasperPrint jasperPrint = JasperFillManager.fillReport(this.getClass().getResourceAsStream("/ReportTest.jasper"), parametros, new JREmptyDataSource());

              • 19. Re: Seam with JSF and Jasper Reports
                andre1001

                Excuse me,


                now, with formatation:


                .ear 
                -- lib 
                ---- groovy-all-1.5.5.jar 
                ---- jasperreports-3.6.0.jar (with Maven, exclude xml-apis.jar) 
                -- .jar 
                ---- ReportTest.jasper 
                ---- action (java source) 
                -- .war
                



                • 20. Re: Seam with JSF and Jasper Reports
                  nicolettait

                  Thank you so much Giovanni for your instructions. I've followed them and now I can print a report without errors passing parameters and using a JDBC connection to MySql.


                  But now my problem: I'm trying to use the hibernate connection to receive the data and in order to do this I created the entityManager (as in your example) and I passed to the fillReport method a new JREmptyDataSource() as a connection, but when the PDF file is printed the fields are filled with null. Probably I've made some mistakes in the report itself (I'm using iReport) because I kept the same field, with the same name I used for the ODBC connection.
                  Are there any issues I should know to manage the field in case of hibernate connection?


                  Thanki you so much in advance
                  Nicoletta

                  • 21. Re: Seam with JSF and Jasper Reports
                    vata2999

                    Hi guys,
                    after i run report i've got this
                    Document root element jasperReport, must match DOCTYPE root null
                    am i missing sth ?

                    1 2 Previous Next