java - Radio button selection with primefaces -


i have following radio button-selectable datatable:

<h:form>          <p:datatable value="#{gerardocumentobacking.reclamantes}"                      selection="#{gerardocumentobacking.reclamante}" var="re" rowkey="#{re.id}">             <p:column headertext="id">                 <h:outputtext value="#{re.id}"/>             </p:column>             <p:column headertext="relamantes">                 <h:outputtext value="#{re.nome}"/>             </p:column>             <p:column selectionmode="single"/>         </p:datatable>           <p:commandbutton value="gerar" action="#{gerardocumentobacking.gerar}"/> </h:form> 

it displays rows , radio button expected. however, it's not setting reclamante variable, specified in selection= attribute.

the setreclamante method available , public:

@named @viewscoped public class gerardocumentobacking implements serializable {  private static final long serialversionuid = 1l; private list<reclamante> reclamantes; private reclamante reclamante;  @ejb private reclamanteservice reclamanteservice;  @postconstruct public void init() {     reclamantes = reclamanteservice.listar(); }  public string gerar() {     system.out.println(reclamante.getnome());     return null; }  public reclamante getreclamante() {     return reclamante; }  public void setreclamante(reclamante reclamante) {     this.reclamante = reclamante; } ... 

using ide debugging, see setreclamante method being called null value, gerar method throwing nullpointerexception @ line system.out.println(reclamante.getnome());. datatable has rowkey attribute , know it's valid because it's being displayed in datatable.

i need command button outside datatable because intend use other datatables inside h:form.

found problem. page had <head> tag instead of <h:head>.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -