10 Replies Latest reply on Jul 16, 2010 8:50 AM by ehsmurali

    Seam and CrystalReports JSF tags?

    arw
      Hey everyone :O

      I'm a relatively new SEAM user (2.1.0.GA I believe) however I have already created a few small apps with it and I'm really liking it so far :D

      Now onto the important stuff...

      I'm trying to implement the viewing of processed Crystal Reports in a seam app. So far what works is getting reports from the server, building inputs for the reports params, taking those values back and passing them to the server.

      Now I can see the server process the report, my app polls it until it's ready to be viewed ... that all works fine. The problem I'm having now is the XHTML page where I've included the crystal 'reportPageViewer' tag which should supposedly render the report to HTML... however it produces only a blank page.

      Below is the page code. Note that when I view the page source after it is rendered to the browser the crystal tag (<bocrv:reportPageViewer ... />) still says simply that, it hasn't resolved/compiled/rendered into normal markup.

      Am I doing something obviously wrong here? Do I need to follow some wierd process in order to be able to use these Crystal-JSF tags? If anyone can help I'd really appreciate it!

      `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <f:view contentType="text/html"
              xmlns="http://www.w3.org/1999/xhtml"
              xmlns:ui="http://java.sun.com/jsf/facelets"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:s="http://jboss.com/products/seam/taglib"
              xmlns:bocrv="http://www.businessobjects.com/jsf/crystalreportsviewers">
      <html>
      <head>
          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
          <title>Report Viewer</title>
      </head>

      <body style="margin: 0;
                   padding: 0;
                   border: 0;">

          &lt;bocrv:reportPageViewer reportSource="#{viewableReportSource.viewer}" viewerName="reportViewer" /&gt;

      </body>
      </html>
      </f:view>`

        • 1. Re: Seam and CrystalReports JSF tags?
          arw
          Sorry for bad formatting of original post... please transpose html character codes with their proper < > in your mind... I tried to change them for forum validation but obviously it didn't work properly (validator didn't like the bocrv tag for some reason).
          • 2. Re: Seam and CrystalReports JSF tags?
            arw

            Shameless bump for new work day :(

            • 3. Re: Seam and CrystalReports JSF tags?
              arw

              Ok I got it working if anyone is interested.


              Really the problem was just that I didn't full understand how to setup a taglib in facelets.


              You need to create the xyz.taglib.xml descriptor file and then reference it from the web.xml and all is well :D

              • 4. Re: Seam and CrystalReports JSF tags?
                dandausch

                Hi Al, Thanks for the post. I am just starting an effort to use Crystal Reports with facelets and any help you can provide to help get me jump started would be much appreciated.

                • 5. Re: Seam and CrystalReports JSF tags?
                  bf
                  Hi Al. I created a crystal-report.taglib.xml:

                  <facelet-taglib>
                      <namespace>http://www.businessobjects.com/jsf/crystalreportsviewers</namespace>

                      <tag>
                          <tag-name>reportPageViewer</tag-name>
                          <component>
                              <component-type>com.crystaldecisions.report.web.jsf.JSFViewerTag</component-type>
                          </component>
                      </tag>

                  </facelet-taglib>

                  But I got an exception:

                  SEVERE: Error Rendering View[/abc.xhtml]
                  javax.faces.FacesException: Expression Error: Named Object: com.crystaldecisions.report.web.jsf.JSFViewerTag not found.
                          at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:564)


                  I have put webreporting-jsf.jar and webreporting.jar in WEB-INF/lib folder so JSFViewerTag class is there.

                  Do you know what I have done wrong? Thanks.
                  • 6. Re: Seam and CrystalReports JSF tags?
                    matthewdemerath

                    Libo,
                    I'm having the same problem. Did you find the answer?
                    Matthew

                    • 7. Re: Seam and CrystalReports JSF tags?
                      john234

                      could any one pelase share the code. i am getting blank report.

                      • 8. Re: Seam and CrystalReports JSF tags?
                        haloleon
                        Here is the setup for configuring reportPageViewer  (JSF Reporting Component) to work with JSF and Facelets

                        1. crystalreports-jsf.jar does not come with a facelets taglib - You will need to create one such as:

                        crystal-reports.taglib.xml:

                        <?xml version="1.0" encoding="UTF-8"?>
                        <!DOCTYPE facelet-taglib PUBLIC
                        "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
                        "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
                        <facelet-taglib>
                            <namespace>http://www.businessobjects.com/jsf/crystalreportsviewers</namespace>
                            <tag>
                                <tag-name>reportPageViewer</tag-name>
                                <component>
                                    <component-type>com.crystaldecisions.report.web.jsf.JSFViewerTag</component-type>
                                </component>
                            </tag>
                        </facelet-taglib>

                        Place this inside WEB-INF

                        2. Modify your web.xml to read the new taglib.

                        <context-param>
                            <param-name>facelets.LIBRARIES</param-name>
                            <param-value>/WEB-INF/crystal-reports.taglib.xml</param-value>
                        </context-param>

                        3. Modify the faces-config.xml file to support the new components:

                        <component>
                            <component-type>com.crystaldecisions.report.web.jsf.JSFViewerTag</component-type>
                                 <component-class>
                                    com.crystaldecisions.report.web.jsf.UIReportPageViewer
                                 </component-class>
                        </component>
                        <render-kit>
                            <renderer>
                                <component-family>CrystalReports.DHTMLViewer</component-family>
                                <renderer-type>CrystalReports.ViewerHtmlRenderer</renderer-type>
                                <renderer-class>
                               com.crystaldecisions.report.web.jsf.ViewerHtmlRenderer
                                </renderer-class>
                            </renderer>
                        </render-kit>

                        You may also need to add the localization to the application tag in faces-config, such as:

                        <locale-config>
                            <default-locale>en</default-locale>
                            <supported-locale>en</supported-locale>
                        </locale-config>

                        3. Add the required jars to your classpath (This will vary based upon project setup and features required, but at minimum, it will need: CrystalCommons2, Crystal Runtime, WebReporting-jsf, Webreporting )

                        This should allow JSF to recognize the Crystal Report tag and you can then pass in a IReportSource via an EL expression.

                        Hope this helps as I found getting information on this topic to be a little sparse.
                        • 9. Re: Seam and CrystalReports JSF tags?
                          ernest210.paluchhubert.o2.pl

                          Hello. I know this topic is a little old but maybe someone can help my.
                          I'm using Cristal in my web app JSF(IceFaces) and JBoss Cristal working fine (thanks for this topic) but I have a little problem I want to display my report (all report page) on one page. I don’t see any way how to do this using this tag.
                          I'm asking here because you resolve all problems with configuration (which wasn't simple) and maybe already someone resolve my problem.

                          • 10. Re: Seam and CrystalReports JSF tags?
                            ehsmurali

                            Hi Shannon,
                                       I followed all the steps, yet my facelet redered as blank, no error.
                                       Am I missing any configuration.
                            Thanks,
                            Murlai.