Partial processing enables executing certain components while ignoring others during a request.
<div class="card">
<h:form>
<h:panelGrid id="grid" cellpadding="7" columns="2" styleClass="mb-3">
<p:outputLabel for="firstname" value="Firstname:"/>
<p:inputText id="firstname" value="#{processView.firstname}"/>
<p:outputLabel for="middle" value="Middle:"/>
<p:inputText id="middle" value="#{processView.middlename}"/>
<p:outputLabel for="surname" value="Surname:"/>
<p:inputText id="surname" value="#{processView.lastname}" required="true"
requiredMessage="Surname is required"/>
</h:panelGrid>
<p:commandButton value="All" id="btnAll" process="@all" update="grid msgs" action="#{processView.save}" styleClass="mr-2"/>
<p:commandButton value="Form" id="btnForm" process="@form" update="grid msgs" action="#{processView.save}" styleClass="mr-2"/>
<p:commandButton value="This" id="btnThis" process="@this" update="grid msgs" action="#{processView.save}" styleClass="mr-2" resetValues="true" />
<p:commandButton value="None" id="btnNone" process="@none" update="grid msgs" action="#{processView.save}" styleClass="mr-2" resetValues="true" />
<p:commandButton value="Parent" id="btnParent" process="@parent" update="grid msgs" action="#{processView.save}" styleClass="mr-2"/>
<p:commandButton value="This Surname" id="btnSurname" process="@this,surname" update="grid msgs" action="#{processView.save}"/>
<p:messages id="msgs"/>
</h:form>
</div>
package org.primefaces.showcase.view.ajax;
import jakarta.enterprise.context.RequestScoped;
import jakarta.faces.application.FacesMessage;
import jakarta.faces.context.FacesContext;
import jakarta.inject.Named;
import io.quarkus.runtime.annotations.RegisterForReflection;
@Named
@RequestScoped
@RegisterForReflection(serialization = true)
public class ProcessView {
private String firstname;
private String middlename;
private String lastname;
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public String getMiddlename() {
return middlename;
}
public void setMiddlename(String middlename) {
this.middlename = middlename;
}
public String getLastname() {
return lastname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
public void save() {
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage("Welcome " + firstname + " " + middlename + " " + lastname));
}
}