What I have right now is (file xhtml):
<h:form>
<h:dataTable value="#{userL.listUser}" var="o"
styleClass="order-table"
headerClass="order-table-header"
rowClasses="order-table-odd-row,order-table-even-row"
>
<h:column>
<f:facet name = "header">Login</f:facet>
<h:outputText value = "#{o.name}"/>
</h:column>
<h:column>
<f:facet name = "header">Nom</f:facet>
<h:outputText value = "#{o.nom}" />
</h:column>
<h:column>
<f:facet name = "header">Age</f:facet>
<h:outputText value = "#{o.age}"/>
</h:column>
<h:column>
<f:facet name = "header">Email</f:facet>
<h:outputText value = "#{o.email}"/>
</h:column>
<h:column>
<f:facet name="header">Edit</f:facet>
<h:commandButton value="Edit" action="#{o.editAction(o)}" >
<f:ajax execute="@form" render=":form_modif" />
</h:commandButton>
</h:column>
<h:column>
<h:commandLink id="remove" value="delete" action="#{userLService.deleteStudent(o)}"
onclick="return confirm('Are you sure?')">
</h:commandLink>
</h:column>
</h:dataTable>
</h:form>
<h:form id="form_modif">
<h:outputLabel value="Enter your Login: " />
<h:inputText value="#{userL.name}"/>
<h:outputLabel value="Enter your Pass: " />
<h:inputText value="#{userL.pass}"/>
<h:outputLabel value="Enter your Age: " />
<h:inputText value="#{userL.age}"/>
<h:outputLabel value="Enter your email: " />
<h:inputText value="#{userL.email}"/>
<h:outputLabel value="Enter your nom: " />
<h:inputText value="#{userL.nom}"/>
<h:commandButton value="Submit" action="#{userL.submit}">
</h:commandButton>
</h:form>
and (bean file):
@ManagedBean
@ApplicationScoped
public class UserL {
private UserL user;
private String name;
private String pass;
private String email;
private String nom;
private Integer age;
//Differents setter and getters
My first form get from the database the different user and print them, what I want is that by clicking the "Edit" button I get theses informations inside the inputtbox on the second form. How can I do it? I tried to set theses informations like that:
public String editAction(UserL order) {
this.age=order.age;
this.name=order.name;
this.nom=order.nom;
this.email=order.email;
this.pass=order.pass;
System.out.println(nom);
return null;
}
But nothing happen. I do get the information on the first form but I can seem to pass them to the 2nd one and have them prefilled the differents inputtext.