PrimeFaces extens the Faces Search Expressions by more keywords.
<div class="card">
<h:form>
<p:panel id="panel" header="Search Form" styleClass="mb-3">
<p:growl id="messages"/>
<div class="formgrid grid p-fluid">
<div class="field col-12 md:col-6">
<p:outputLabel for="txt1" value="Text 1"/>
<p:inputText id="txt1" value="#{searchView.text1}" required="true" label="Text 1">
<f:validateLength minimum="2"/>
</p:inputText>
<p:message for="txt1"/>
<small>Value: <h:outputText value="#{searchView.text1}"/></small>
</div>
<div class="field col-12 md:col-6">
<p:outputLabel for="txt2" value="Text 2"/>
<p:selectOneMenu id="txt2" value="#{searchView.text2}" required="true" label="Text 2">
<f:selectItem itemLabel="Select One" itemValue="" noSelectionOption="true"/>
<f:selectItem itemLabel="Option 1" itemValue="1"/>
<f:selectItem itemLabel="Option 2" itemValue="2"/>
<f:selectItem itemLabel="Option 3" itemValue="3"/>
</p:selectOneMenu>
<p:message for="@previous"/>
<small>Value: <h:outputText value="#{searchView.text2}"/></small>
</div>
</div>
</p:panel>
<p:commandButton process="@parent:@parent" update="@form" value="Process: @parent:parent (Form)" styleClass="mr-2 mb-2" />
<p:commandButton process="@form:@child(1):txt1" update="@form"
value="Process: @form:@child(1):txt1 (Text 1)" styleClass="mb-2"/>
</h:form>
</div>
package org.primefaces.showcase.view.ajax;
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Named;
@Named
@RequestScoped
public class SearchView {
private String text1;
private String text2;
public String getText1() {
return text1;
}
public void setText1(String text1) {
this.text1 = text1;
}
public String getText2() {
return text2;
}
public void setText2(String text2) {
this.text2 = text2;
}
}