Java Reference
In-Depth Information
value="#{registrationBean.lastName}" />
<p:outputLabel for="age" value="Age:"/>
<p:inputText id="age" label="Age" size="2"
value="#{registrationBean.age}"/>
<p:outputLabel value="Email Address:" for="email"/>
<p:inputText id="email" label="Email Address"
required="true"
value="#{registrationBean.email}">
<f:validatorvalidatorId="emailValidator"/>
</p:inputText>
<h:panelGroup/>
<p:commandButton id="register" value="Register"
action="confirmation"
ajax="false"/>
</p:panelGrid>
</h:form>
As we can see, for the most part, all we had to do was to replace JSF-specific tags
with their PrimeFaces-specific counterparts. For aesthetic reasons, we also changed
the number of columns of <p:panelGrid> to two (as opposed to three in the original
<h:panelGrid> tag) and replaced the <h:message> tags in the original page with a
top-level <p:messages> tag.
By default, PrimeFaces command buttons are Ajax enabled. So, for this particular
example, we explicitly disabled Ajax on our command button by setting its ajax
attribute to false .
Another nice feature of PrimeFaces is that validation messages are nicely
styled and all fields that fail validation are highlighted in red, as shown in
the following screenshot:
 
Search WWH ::




Custom Search