Java Reference
In-Depth Information
The last new PrimeFaces component we used in our page is
<p:commandButton>
,
by default, this component renders a button that triggers AJAX requests to update
parts of our page without doing a full page request. This component can also be
used as a drop-in replacement for the standard JSF
<h:commandButton>
component.
To do this, we need to set its
ajax
property to
false
, which is what we did in our
example. The advantage of using
<p:commandButton>
as a drop-in replacement
for
<h:commandButton>
is that
<p:commandButton>
is nicely rendered by default,
without the need for us to create custom CSS styles for our buttons.
When clicking on the button in our example, the user is directed to a confirmation
page.
We didn't use any new PrimeFaces components in the confirmation page, therefore
we won't be discussing it. Its markup can be found in this chapter's download
(
confirmation.xhtml
).
Tabbed views
Frequently, HTML forms have several fields that would typically result in very
long forms. It is common to divide a form into two or more tabs, that way the page
looks less overwhelming to the user. Normally, creating a page with tabs requires
some HTML and JavaScript tricks, however, PrimeFaces includes a
<p:tabView>
component we can use to easily generate tabs, the following example illustrates how
to use this component:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">