【发布时间】:2012-04-08 02:09:28
【问题描述】:
我有一个关于 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">
这是我的 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());
}
}
可能是什么问题?好像DataTable变量被误认为是String?
感谢您的所有帮助。谢谢。
【问题讨论】:
标签: binding jsf-2 datatable primefaces