Book Image

Mastering JavaServer Faces 2.2

By : Anghel Leonard
Book Image

Mastering JavaServer Faces 2.2

By: Anghel Leonard

Overview of this book

Table of Contents (20 chapters)
Mastering JavaServer Faces 2.2
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
The JSF Life Cycle
Index

Grouping components under <f:ajax> tag


Sometimes, it may be useful to group multiple components under the same <f:ajax> tag. For example, the following code snippet groups two <h:inputText> components under the same <f:ajax> tag (you can nest other components as well):

<f:ajax event="click" execute="submitFormId" render="submitFormId">
  <h:form id="submitFormId"> 
    Name:
    <h:inputText id="nameId" value="#{ajaxBean.name}" 
                           validator="nameValidator"/>
    <h:message id="msgNameId" showDetail="true" showSummary="true" 
                           for="nameId" style="color: red;"/>
    Surname:            
    <h:inputText id="surnameId" value="#{ajaxBean.surname}" 
                           validator="nameValidator"/>
    <h:message id="msgSurnameId" showDetail="true" showSummary="true"   
                           for="surnameId" style="color: red;"/>
    </h:form>
</f:ajax>

So, how does...