1 Reply Latest reply on Nov 17, 2010 12:17 PM by ginni

    Seam 2.2.1 CR1 & Excel

    ginni

      I have searched the forums, followed all the examples and suggestions (including Lance's excellent post) but nothing will get me past this error:


      Target Unreachable, 'excelExporter' returned null on 'org.jboss.seam.Namespace'
      



      I modified my web.xml by adding


              <servlet>
                      <servlet-name>Document Store Servlet</servlet-name>
                      <servlet-class>org.jboss.seam.document.DocumentStoreServlet</servlet-class>
              </servlet>
              <servlet-mapping>
                      <servlet-name>Document Store Servlet</servlet-name>
                      <url-pattern>*.csv</url-pattern>
              </servlet-mapping>
              <servlet-mapping>
                      <servlet-name>Document Store Servlet</servlet-name>
                      <url-pattern>*.xls</url-pattern>
              </servlet-mapping>
      



      I modified my components.xml by adding


      under 'components'
              xmlns:excel="http://jboss.com/products/seam/excel"
              xmlns:document="http://jboss.com/products/seam/document"
      under schema locations
              http://jboss.com/products/seam/document http://jboss.com/products/seam/document-2.2.xsd
              http://jboss.com/products/seam/excel http://jboss.com/products/seam/excel-2.2.xsd
      and
      <excel:document-store use-extensions="true"/>
      



      I am using Maven2, added the dependency to the pom and ran mvn install, no errors


              <dependency>
                              <groupId>org.jboss.seam</groupId>
                              <artifactId>jboss-seam-excel</artifactId>
                              <version>2.2.1.CR1</version>
                              <scope>provided</scope>
                      </dependency>
      


      And in my page added


                      <h:form id="excelReport">
      
                      <rich:dataTable 
                              width="100%"
                              var="record"
                              id="authorizationListTable"
                              value="#{authorizationList}" 
                              ...
                      ... columns...
                      </rich:dataTable>
                      <h:commandButton id="export" type="submit" value="Export to Excel" action="#{org.jboss.seam.excel.excelExporter.export('excelReport:authorizationListTable')}" />
                      
                      </h:form>
      



      What could I possibly be missing?


      Thanks,
      Ginni

        • 1. Re: Seam 2.2.1 CR1 & Excel
          ginni

          More info. I searched for the class in Eclipse and noticed its packaging was different than how I had it, so I changed my button to this:


          <h:commandButton id="exporter" type="Submit" value="Export to Excel" action="#{org.jboss.seam.excel.exporter.excelExporter.export('excelReport:authorizationListTable')}" />
          



          and now I get this error:


          Caused by: javax.faces.el.EvaluationException: org.jboss.seam.excel.ExcelWorkbookException: Could not find data table with id excelReport:authorizationListTable
          



          So, I viewed the source of my page to make sure the rich datatable wasn't doing something strange, and I saw that my table's ID was indeed different.


          
          <table class="rich-table table" id="authorizationListForm:excelReport:authorizationListTable" style="border-top-width: 1px;" border="0" cellpadding="0" cellspacing="0" width="100%">...
          
          



          Then I modified my commandButton once again as is here:


          
          <h:commandButton id="exporter" type="Submit" value="Export to Excel" action="#{org.jboss.seam.excel.exporter.excelExporter.export('authorizationListForm:excelReport:authorizationListTable')}" />
          



          This works. I hope this helps someone else.


          Ginni