Java Reference
In-Depth Information
Adding Multiple Child Components to a Facet
Although the <f:facet> tag only accepts a single child component,
we can add multiple components to it by nesting them inside an
<f:panelGroup> tag.
Although not shown in the example, <h:column> also defines a facet with a name of
footer that can be used to render a footer for the column. We simply would add a
second facet named footer inside our <h:column> tag.
Next we add the tags that will be displayed as a single cell for the particular
column. We can access the current item in the collection or array. We will be
iterating, by using the value of the var attribute of <h:dataTable> ( item , in our
particular example).
In our example we simply display the values for a single property or each item,
however any JSF component can be placed inside <h:column> .
Before we can deploy our application and see the above page in action, we need to
create the RegistrationListController managed bean.
Recall that the easiest way to create JSF managed beans is by going to File
| New , selecting the JavaServer Faces category, and JSF Managed Bean
as the file type. This procedure is covered in detail earlier in this chapter.
Our managed bean is shown next:
package com.ensode.jsf;
import java.util.ArrayList;
import java.util.List;
public class RegistrationListController {
private List<RegistrationBean> registrationBeanList;
public RegistrationListController() {
}
public String populateList() {
registrationBeanList = new
ArrayList<RegistrationBean>();
 
Search WWH ::




Custom Search