Popular datatable jsf

0

I'm new to JSF, I'd like a tip, how can I populate a datatable through a selection of a combobox that brings a list of items from the database.

    
asked by anonymous 02.08.2016 / 15:04

1 answer

0

If you are using JSF 2.0 or higher, you can use the f:ajax

<h:selectOneMenu value="#{bean.itemSelecionado}">
    <f:selectItems value="#{bean.itens}" var="item" itemLabel="#{item.nome}" itemValue="#{item.id}"/>
    <f:ajax listener="#{bean.listarDataTable}" render="idDoDataTable"/>
</h:selectOneMenu>
    
02.08.2016 / 16:33