This example demonstrates a simple but common usage of posting the form, updating the backend value and displaying the output with ajax.
Documentation<h:form>
<h:panelGrid columns="4" cellpadding="5">
<h:outputLabel for="name" value="Name:" style="font-weight:bold" />
<p:inputText id="name" value="#{basicView.text}" />
<p:commandButton value="Submit" update="display" icon="pi pi-check" />
<h:outputText id="display" value="#{basicView.text}" />
</h:panelGrid>
</h:form>@Named
@RequestScoped
public class BasicView {
private String text;
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
}