2012-12-17 62 views
0

我對java primefaces有問題,無法在數據表中發現行

我有我的xhtml,如下所示;

<p:layoutUnit position="center"> 
      <h:form> 
       <p:dataTable id="dataTable" var="car" value="#{myProjects.projects}" sortMode="multiple" rows="25" paginator="true"> 
        <f:facet name="header"> 
         Dahil Olduğum Projeler 
        </f:facet> 

        <p:column id="modelHeader" sortBy="#{projectsList.sector}"> 
         <f:facet name="header"> 
          <h:outputText value="Sektör" /> 
         </f:facet> 
         <h:outputText value="#{projectsList.sector}" /> 
        </p:column> 

        <p:column sortBy="#{projectsList.projectName}"> 
         <f:facet name="header"> 
          <h:outputText value="İşin Adı" /> 
         </f:facet> 
         <h:outputText value="#{projectsList.projectName}" /> 
        </p:column> 

        <p:column sortBy="#{projectsList.startDate}"> 
         <f:facet name="header"> 
          <h:outputText value="Başlangıç Tarihi" /> 
         </f:facet> 
         <h:outputText value="#{projectsList.startDate}" /> 
        </p:column> 

        <p:column sortBy="#{projectsList.endDate}"> 
         <f:facet name="header"> 
          <h:outputText value="Bitiş Tarihi" /> 
         </f:facet> 
         <h:outputText value="#{projectsList.endDate}" /> 
        </p:column> 
        <p:column> 
         <f:facet name="header"> 
          <h:outputText value="Son Durum" /> 
         </f:facet> 
         <h:outputText value="#{projectsList.lastStats}" /> 
        </p:column> 
       </p:dataTable> 

      </h:form> 


     </p:layoutUnit> 

而且我也有我的MyProjects的java文件:

@ManagedBean(name="MyProjects") 
@SessionScoped 
public class MyProjects implements Serializable { 

    private List<ProjectsList> projects; 

    public MyProjects(){ 
     projects=new ArrayList<ProjectsList>(); 
    projects.add(new ProjectsList("asd","asd","asd","asd","asd")); 
    projects.add(new ProjectsList("asd","asd","123","123","123")); 
    projects.add(new ProjectsList("asd","asd","123","123","123")); 
    projects.add(new ProjectsList("asd","asd","123","123","123")); 
} 

public List<ProjectsList> getProjects(){ 
    projects.get(0); 



     return projects; 
    } 


} 

當我想看到的數據表我行(例如這裏我添加4項),我只看到4行沒有文字在裏面。

如何使條目可見?

在此先感謝。

回答

3

<h:outputText value="#{projectsList.sector}" />應該<h:outputText value="#{car.sector}" />(和表中的所有EL表達式相似的。正如在數據表中的「VAR」屬性定義。

0

數據表變量var="car"列沒有使用。它必須是

<p:column sortBy="#{car.projectName}"> 
    <f:facet name="header"> 
    <h:outputText value="İşin Adı" /> 
    </f:facet> 
    <h:outputText value="#{car.projectName}" /> 
</p:column> 

而且car這裏不是正確的變量。將它命名爲像
var='project' value="#{myProjects.projects}"