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;
    }


}

当我想查看数据表 I 中的行时(例如,在这里我添加了 4 个条目),我只看到 4 行没有文本。

如何使条目可见?

提前致谢。

4

2 回答 2

3

<h:outputText value="#{projectsList.sector}" />应该是<h:outputText value="#{car.sector}" />(并且对于表中的所有 EL 表达式都类似。如数据表的“var”属性中所定义。

于 2012-12-17T09:33:09.077 回答
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}"

于 2012-12-17T09:56:53.893 回答