<a:form> <a:panel id="panel" header="Search Form" style="margin-bottom:10px;"> <a:messages id="messages" /> <h:panelGrid columns="4" cellpadding="5"> <h:outputLabel for="txt1" value="Text 1: *" /> <a:inputText id="txt1" value="#{searchView.text1}" required="true" label="Text 1"> <f:validateLength minimum="2" /> </a:inputText> <a:message for="txt1" /> <h:outputText value="#{searchView.text1}" /> <h:outputLabel for="txt2" value="Text 2: *" /> <h: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" /> </h:selectOneMenu> <a:message for="@previous" /> <h:outputText value="#{searchView.text2}" /> </h:panelGrid> </a:panel> <h:panelGrid columns="2"> <a:commandButton process="@parent:@parent" update="@form" value="Process: @parent:parent (Form)" /> <a:commandButton process="@form:@child(1):txt1" update="@form" value="Process: @form:@child(1):txt1 (Text 1)" /> </h:panelGrid> </a:form>
package com.jarch.showcase.view.ajax; import javax.faces.bean.ManagedBean; @ManagedBean 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; } }