The following code implements a datatable inside a layout, in the datatable i added an edit button in each row
<p:dataTable id="tbl" var="person" value="#{mybean.listPersons}" > 
            <p:column>
                <f:facet name="header">
                    <h:outputText value="Name " />
                </f:facet>
                <h:outputText value="#{person.name}" />
            </p:column>
            <p:column>
                <f:facet name="header">
                    <h:outputText value="Age :" />
                </f:facet>
                <h:outputText value="#{person.age}" />
            </p:column>
            <p:column>
                 <p:commandButton icon="ui-icon-pencil" 
                 oncomplete="PF('dlg1').show();"  action="mybean.setSelectedPerson(person)"  />
            </p:column>
</p:dataTable>
When i click on the edit button, the dialog box (code below) is shown but the inputs are empty, what i wanted is to show the infos of the row in the dialog bow, i'm still a beginner, i searched everywhere... but no results
<p:dialog header="Modify" widgetVar="dlg1" >
        <h:form  >
              <p:growl id="msgs" showDetail="true" />
              <h:panelGrid id="form2" value="#{myBean.person}" var="person">
                        <p:outputLabel  value="Name :" />
                        <p:inputText  value="#{person.name}" />
                        <p:outputLabel value="Age :" />
                        <p:inputText value="#{person.age}" />
                        <p:commandButton value="Submit" action="#{myBean.modifyPerson(person)}"  />
                </h:panelGrid>
    </h:form>
</p:dialog>
@ManagedBean
@RequestScoped
public class muBean implements Serializable{
    private Person selectedPerson;
    //getter and setter
    public void modifyPerson(Person p) {
         this.selectedPerson = p;
    }
}
i would be so grateful if anyone can help, i really need this
 
     
    