我有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行没有文本。
如何使条目可见?
提前致谢。
答案 0 :(得分:3)
<h:outputText value="#{projectsList.sector}" />
应为<h:outputText value="#{car.sector}" />
(对于表中的所有EL表达式都类似。正如数据表的“var”属性中所定义。
答案 1 :(得分: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}"