我有关于primefaces数据表组件的问题.我想将一个DataTable变量绑定到p:dataTable,以便我能够从支持bean以编程方式操作第一行,rowsPerPageTemplate等.但我陷入困境并不断获取java.lang.String无法转换为javax.faces.component.UIComponent.
这是我的p:dataTable声明.
<p:dataTable id="dtProductCategoryList" value="#{saProductCategoryController.saproductcategories}" rowsPerPageTemplate="#{appConfig.rowsPerPageTemplate}"
paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
currentPageReportTemplate="{currentPage} #{bundle.DataTablePageSeparator} {totalPages}"
paginatorAlwaysVisible="false" var="item" paginator="true" rows="#{appConfig.rowsPerPageDefault}"
binding="saProductCategoryController.dtProductCategory">
Run Code Online (Sandbox Code Playgroud)
这是我的ViewScoped支持bean.
private DataTable dtProductCategory;
/** Creates a new instance of saProductCategoryController */
public SaProductCategoryController() {
}
@PostConstruct
public void Init() {
try {
dtProductCategory = new DataTable();
//dtProductCategory.
saproductcategories = saProductCategoryFacade.selectAll();
LogController.log.info("Creating postconstruct for saProductCategoryController");
} catch (Exception ex) {
LogController.log.fatal(ex.toString());
}
}
Run Code Online (Sandbox Code Playgroud)
可能是什么问题呢?似乎DataTable变量被误认为是String?
感谢您的所有帮助.谢谢.