1 Reply Latest reply on Feb 28, 2012 7:21 AM by Sergio Angelo

    seam excel, execute a query for each cell

    bruce77 Newbie

      Hi,

      i have a table "Person" to display the list of records, I wrote:

       

      <html xmlns="http://www.w3.org/1999/xhtml"
           xmlns:ui="http://java.sun.com/jsf/facelets"
           xmlns:e="http://jboss.com/products/seam/excel"
           xmlns:f="http://java.sun.com/jsf/core">
      
      
      <e:workbook type="#{exportType}">
           <e:worksheet value="#{personList.resultList}" var="person">
                <e:column>
                     <f:facet name="header">
                          <e:cell value="First name"/>
                     </f:facet>
                     <e:cell value="#{person.firstName}"/>
                </e:column>
                <e:column>
                     <f:facet name="header">
                          <e:cell value="Last name"/>
                     </f:facet>
                     <e:cell value="#{person.lastName}"/>
                </e:column>
                <e:column>
                     <f:facet name="header">
                          <e:cell value="city"/>
                     </f:facet>
                     <e:cell value="#{person.city}"/>
                </e:column>
                <e:column>
                     <f:facet name="header">
                          <e:cell value="cap"/>
                     </f:facet>
                     <e:cell value="#{person.cap}"/>
                </e:column>
                <e:column>
                     <f:facet name="header">
                          <e:cell value="address"/>
                     </f:facet>
                     <e:cell value="#{person.address}"/>
                </e:column>
                <e:column>
                     <f:facet name="header">
                          <e:cell value="age"/>
                     </f:facet>
                     <e:cell value="#{person.age}"/>
                </e:column>
      
           </e:worksheet>
      </e:workbook>
      </html>
      

       

       

       

      but in this way for any "e:cell" is executed a query on the db, so in total 6.

       

      How can I modify this code to have just a query at once?


      Thank you.

       

      p.s. the query is: "select firstName, lastName, city, cap, address, age from person"