Linking dataTable boards to org.primefaces.component.datatable.DataTable;

I have a question about the datatable component. I want to bind a DataTable variable to p: dataTable so that I can manipulate the first one, rows, stringsPerPageTemplate, etc. Programmatically from a backup bean. But I am stuck and keep getting java.lang.String cannot be passed to javax.faces.component.UIComponent.

Here's my p: dataTable declaration.

<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">

      

And here is my ViewScoped bean support.

    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());
    }
}

      

What could be the problem? Seems like DataTable variable is wrong for row?

Appreciate all your help. Thank.

+3


source to share


2 answers


java.lang.String cannot be passed to javax.faces.component.UIComponent.

The attribute binding

should refer to UIComponent

, not plain vanilla String

. Indeed, you forgot #{}

around the attribute value that would make it look like plain vanilla String

.



Correct it accordingly:

binding="#{saProductCategoryController.dtProductCategory}"

      

+5


source


Replace

binding="saProductCategoryController.dtProductCategory"

      



from

binding="#{saProductCategoryController.dtProductCategory}"

      

+2


source







All Articles