我在<p:dataTable>
页面中有一个xhtml
。该表不会显示辅助bean的值。我已调试到我知道bean的getter被调用了,我也知道这个bean中有些东西。为什么会这样? Netbeans 7.3,JSF2.2,Tomcat 7,jdk1.7,primefaces 4.0。
这是我的表,这是一个名为'mainForm'
的表格<p:dataTable id="DTsamples" widgetVar="DTsamplesVw" var="sample" value="#{alterSampleController.samples}"
filteredValue="#{alterSampleController.filteredSamples}" paginator="true" rows="20"
sortMode="multiple" scrollable="true" rowStyleClass="#{sample.rowColorByType}">
<p:column headerText="Lab Number" footerText="Lab Number" sortBy="labNumber" filterMatchMode="contains" filterBy="labNumber" filterMaxLength="20">
#{sample.labNumber}
</p:column>
<p:column headerText="Container ID" footerText="Container ID" sortBy="containerID" filterMatchMode="contains" filterBy="containerID" filterMaxLength="11">
#{sample.containerID}
</p:column>
<p:column headerText="Sample Type" footerText="Sample Type" sortBy="sampleType" filterMatchMode="contains" filterBy="sampleType" filterMaxLength="50">
#{sample.sampleType}
</p:column>
<p:column headerText="Field ID" footerText="Field ID" sortBy="fieldID" filterMatchMode="contains" filterBy="fieldID" filterMaxLength="150">
#{sample.fieldID}
</p:column>
<p:column headerText="Sample ID" footerText="Sample ID" sortBy="sampleID" filterMatchMode="contains" filterBy="sampleID" filterMaxLength="150">
#{sample.sampleID}
</p:column>
<p:column headerText="Grower" footerText="Grower" sortBy="grower" filterMatchMode="contains" filterBy="grower" filterMaxLength="50">
#{sample.grower}
</p:column>
~~~A few other columns that don't contain data~~~~
</p:dataTable>
这是一个从搜索结果中获取结果的对话框
<h:form id="innerSearch"><p:dialog id="searchDialogID" widgetVar="searchDialog" header="Sample search" resizable="false" draggable="false" showEffect="puff"
hideEffect="puff" appendToBody="false" modal="true" rendered="#{alterSampleController.allowReading eq true}">
~~~Bunch of inputTexts and selectoneMenus to get search details
<p:commandButton update=":mainForm" process="innerSearch" icon="ui-icon-search" value="Search" actionListener="#{alterSampleController.loadSearch}" oncomplete="searchDialog.hide()"/>
</p:dialog>
</h:form>
相关的Backing Bean
@ManagedBean
@ViewScoped
public class AlterSampleController implements Serializable {
private ArrayList<SampleAlter> _samples;
private ArrayList<SampleAlter> _filteredSamples;
public void loadSearch() {
UIComponent table = FacesContext.getCurrentInstance().getViewRoot().findComponent(":mainForm:DTsamples");
table.setValueExpression("sortBy", null);
if (_samples != null) {
_samples.clear();
}
_samples = _saHelper.searchList(getSearch());
}
getAgronomers().clear();
getGrowers().clear();
}
public ArrayList<SampleAlter> getSamples() {
return _samples;
}
public ArrayList<SampleAlter> getFilteredSamples() {
return _filteredSamples;
}
public void setFilteredSamples(ArrayList<SampleAlter> filteredSamples) {
this._filteredSamples = filteredSamples;
}
}
答案 0 :(得分:0)
我使用netbeans 7.3并选择更新netbeans。我知道通常这对代码不会产生任何影响,但确实如此;一切都工作正常,直到我更新。我必须完全卸载并重新安装netbeans。我不会称这是一个解决方案,但如果其他人正在运行7.3最近的更新,一切都停止工作尝试完全卸载并重新安装。