Primefaces数据导出程序:导出数据问题

问题描述:

我有一个List列表。可以说学生和地址。一对多的关系。在我的数据表中有3列与学生相关的名称,姓氏,年龄,并且在单个列中,我需要显示地址,并将以下字段连接起来,例如地址1,地址2,城市,国家。现在我需要导出表格使用<p:dataExporter>。当我尝试导出为Excel地址对应的列导出为对象(org.primefaces.uirepeat。等等等等..)Primefaces数据导出程序:导出数据问题

我的代码是

<p:dataTable value="#{manager.studentList}" var="item" id="studentData"> 
      <p:column> 
       <f:facet name="header">Name</f:facet> 
       <h:outputText value="#{item.name}" /> 
      </p:column> 
      <p:column> 
       <f:facet name="header">Surname</f:facet> 
       <h:outputText value="#{item.surname}" /> 
      </p:column> 
      <p:column> 
       <f:facet name="header">Age</f:facet> 
       <h:outputText value="#{item.age}" /> 
      </p:column> 
      <p:column> 
       <f:facet name="header">Address</f:facet> 
       <ui:repeat value="#{studentBean.addressList}" var="address"> 
       <h:outputText value="#{address.address1}" /> <br /> 
       <h:outputText value="#{address.address2}" /> <br /> 
       <h:outputText value="#{address.city}" /> <br /> 
       <h:outputText value="#{address.country}" /> 
       </ui:repeat> 
      </p:column> 
     </p:dataTable> 

     <h:commandLink> 
     <p:graphicImage name="/images/excel.png" /> 
     <p:dataExporter type="xls" target="studentData" fileName="studentdetails" pageOnly="true"/> 
    </h:commandLink> 

建议我一些方法来出口。即使我尝试了c:forEach和列。

<p:dataTable value="#{manager.studentList}" rowIndexVar="index" var="item" id="studentData"> 
     <p:column> 
      <f:facet name="header">Name</f:facet> 
      <h:outputText value="#{item.name}" /> 
     </p:column> 
     <p:column> 
      <f:facet name="header">Surname</f:facet> 
      <h:outputText value="#{item.surname}" /> 
     </p:column> 
     <p:column> 
      <f:facet name="header">Age</f:facet> 
      <h:outputText value="#{item.age}" /> 
     </p:column> 
     <p:column> 
      <f:facet name="header">Address</f:facet> 
      <c:forEach var="address" items="#{studentBean.addressList.get(index).address}"> 
       <h:outputText value="#{address.address1}" />, 
       <h:outputText value="#{address.address2}"/>, 
       <h:outputText value="#{address.city}" />, 
       <h:outputText value="#{address.country}" /> 
      </c:forEach> 
     </p:column> 
    </p:dataTable> 

    <h:commandLink> 
    <p:graphicImage name="/images/excel.png" /> 
    <p:dataExporter type="xls" target="studentData" fileName="studentdetails" pageOnly="true"/> 
</h:commandLink> 

我想用C:的forEach是确定