10 Replies Latest reply on Jan 21, 2011 7:03 AM by vinay0986

    rich:datatable to excel export is easy, but I get error

    lstine

      There has to be something that I didn't set up. All I read is that you need jboss-seam-excel and jxl jars in your WEB-INF/lib folder.


      I get this error:


      Caused by: javax.el.PropertyNotFoundException: /emailExport.xhtml @34,121 action="#{org.jboss.seam.excel.excelExporter.export('emailreport:emailList')}": Property 'excelExporter' not found on type org.jboss.seam.Namespace


      from this code:


      <h:form  id ="emailreport">
      <rich:dataTable id="emailList" />
      </h:form>
      <h:commandLink value="Export" action="#{org.jboss.seam.excel.excelExporter.export('emailreport:emailList')}"/>


      Can anyone see what I missed?

        • 1. Re: rich:datatable to excel export is easy, but I get error
          nickarls

          Compare the EAR/WAR layout and xhtml namespace declarations with the example.

          • 2. Re: rich:datatable to excel export is easy, but I get error
            lstine

            It looks like this will be harder than I anticipated. I duplicated the settings in the example located here https://jira.jboss.org/jira/secure/attachment/12320180/excelsvn150.zip
            But I still get the error.


            One question in the jboss-seam.jar there isn't a org.jboss.seam.excel.excelExporter class. Where does this EL binding come from?

            • 3. Re: rich:datatable to excel export is easy, but I get error
              lstine

              Is this document store servlet and seam-excel config correct in my web.xml?



              <filter>
                      <filter-name>Seam Servlet Filter</filter-name>
                      <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
                  </filter>
              
                  <filter-mapping>
                      <filter-name>Seam Servlet Filter</filter-name>
                      <url-pattern>*.pdf</url-pattern>
                  </filter-mapping>
                  
                  <filter-mapping>
                      <filter-name>Seam Servlet Filter</filter-name>
                      <url-pattern>*.xls</url-pattern>
                  </filter-mapping>
                      
                 <servlet>
                    <servlet-name>Document Store Servlet</servlet-name>
                    <servlet-class>org.jboss.seam.pdf.DocumentStoreServlet</servlet-class>
                 </servlet>
                  
                 <servlet-mapping>
                    <servlet-name>Document Store Servlet</servlet-name>
                    <url-pattern>*.pdf</url-pattern>
                 </servlet-mapping> 
                 
                 <servlet-mapping>
                    <servlet-name>Document Store Servlet</servlet-name>
                    <url-pattern>*.xls</url-pattern>
                 </servlet-mapping>  
                 
                 <context-param>   
                        <param-name>webAppRootKey</param-name>
                        <param-value>seam-excel</param-value>
                   </context-param>


              • 4. Re: rich:datatable to excel export is easy, but I get error
                anilerukala

                I am also getting the same error. Property 'excelExporter' not found on type org.jboss.seam.Namespace. I am using Seam 2.0.0.GA with jboss-excel.jar and jxl.jar files in Seam 2.1.0.GA.


                1. Can I use the above two excel jar files in Seam 2.1.0.GA in an application which is developed using Seam 2.0.0.GA?


                I am able to successfully export the data from data table with the excel libraries that you mentioned here. But in my company we are allowed to use only production version libraries. That is why I am trying to use excel libraries in Seam 2.1.GA with Seam 2.0.


                2. I am using extended data model with rich datatable. When I export the data from datatable it is exporting only the results that are in memory (10 records) instead of 30,000 records because my extended data model only getting 10 records at a time. I want to get 10 records from database to show to a user (with a data scroller) but whenever the user clicks export to excel I want to export all the 30,000 results. I can write a dedicated xhtml page in that I will call getAll() method. But I don't want to do that because I am using it in so many places.


                How do I export 30,000 records from rich data table using extended data model without writing a dedicated xhtml page?

                • 5. Re: rich:datatable to excel export is easy, but I get error
                  lstine

                  I finally got it to work. It was a little frustrating because most of the info I found on various topics was brief and nothing was all inclusive. However, it was worth the effort. This will be a huge time-saver for future projects.


                  Here is what I had to do (Note I am using seam 2.0.1 because it is an existing application).


                  web.xml had the document store and other excel entries added:


                  <servlet>
                        <servlet-name>Document Store Servlet</servlet-name>
                        <servlet-class>org.jboss.seam.excel.DocumentStoreServlet</servlet-class>
                     </servlet>
                     
                     <servlet-mapping>
                        <servlet-name>Document Store Servlet</servlet-name>
                        <url-pattern>*.xls</url-pattern>
                     </servlet-mapping>  
                     
                     <context-param>   
                       <param-name>webAppRootKey</param-name>
                       <param-value>seam-excel</param-value>
                     </context-param>



                  components.xml had these configurations added:



                  <components xmlns:excel="http://jboss.com/products/seam/excel"
                              xsi:schemaLocation=
                                  "http://jboss.com/products/seam/excel http://jboss.com/products/seam/excel-2.1.xsd">



                  This application was made as a seam-gen project, so I needed to create a jboss-web.xml file in the resources/WEB-INF directory. Here is the content:


                   <!DOCTYPE jboss-web PUBLIC
                      "-//JBoss//DTD Web Application 4.2//EN"
                      "http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd">
                  
                  <jboss-web>  
                      <class-loading java2ClassLoadingCompliance="false">
                          <loader-repository>
                              seam.jboss.org:loader=seam-excel
                              <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
                          </loader-repository>
                      </class-loading>
                  </jboss-web>



                  Because I have seam 2.0.1 I used the older version of the jboss-seam-excel jar located at https://jira.jboss.org/jira/secure/attachment/12321393/jboss-seam-excel-20080730.jar


                  That and jxl 2.6.6 went into the WEB-INF/lib directory of the WAR.


                  After that, I was all set.A simple data table and a simple link give me the excel spreadsteet.



                  <h:commandButton  id="export_top" type="submit"  styleClass="submit_button"  value="Export to Excel"      action="#{org.jboss.seam.excel.excelExporter.export('emailreport:emailList')}" />
                  
                  <h:dataTable id="emailList" 
                       var="certificationSpecialty"
                       value="#{emailExport.emailList}"
                       styleClass="data_table results"
                       columnClasses="source,company,email"
                       rowClasses="alternateRow1,alternateRow2">
                       <h:column>
                            <f:facet name="header">Source</f:facet>
                            <h:outputText value="#{certificationSpecialty.id.source}" />
                       </h:column>
                       <h:column>
                            <f:facet name="header">Company Name</f:facet>
                            <h:outputText value="#{certificationSpecialty.directory.companyName}" />
                       </h:column>
                       <h:column>
                            <f:facet name="header">Email</f:facet>
                            <h:outputText value="#{certificationSpecialty.directory.email}" />
                       </h:column>
                  </h:dataTable>






                  • 6. Re: rich:datatable to excel export is easy, but I get error
                    lstine

                    I forgot to add that I put this line in components.xml too.



                    <excel:document-store use-extensions="true"/>


                    • 7. Re: rich:datatable to excel export is easy, but I get error
                      benmoore

                      Thanks for the great post, lance. This helped me tremendously. One note: I think you mean to write


                      <document:document-store use-extensions="true"/>


                      instead of


                      <excel:document-store use-extensions="true"/>

                      • 8. Re: rich:datatable to excel export is easy, but I get error
                        sabaranski

                        Pardon my ignorance, but how does one obtain these pre-Seam-2.1 JAR files? 


                        I've followed some of the links mentioned in this thread, and I receive 404 errors indicating that the attachment is not available!


                        Unfortunately I do not have the luxury of upgrading this existing enterprise app to a newer version of Seam. 


                        Thanks for any help one might provide.


                        Best,
                        Steve

                        • 9. Re: rich:datatable to excel export is easy, but I get error
                          vinay0986

                          i am using one commom .xhtml file for all my other .xhtml files.....
                          i am Extended data table in my common file i get the values to extended table throw @DataModel name from my component classses
                          now i want to access datamodel name dynamically for my extended data table ,i am using so amny component classes in my application

                          • 10. Re: rich:datatable to excel export is easy, but I get error
                            vinay0986

                            tytrytr