我有一个关于primefaces数据表组件的问题。我想将一个DataTable变量绑定到p:dataTable,这样我就可以通过支持bean以编程方式操作第一行,rowsPerPageTemplate等。但是我被卡住了,继续得到java.lang.String不能转换为javax.faces.component.UIComponent。使用org.primefaces.component.datatable.DataTable绑定primefaces dataTable;
这是我的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?
感谢您的帮助。谢谢。
OMG我的眼睛已经眯起眼睛。感谢BalusC。 – frazkok 2012-03-23 14:12:04