Including UI components and markup
One of the most common techniques for implementing the Composite View design pattern is the Server Side Include (SSI) technique. JSP supports the<jsp:include>
server-side include element, and Facelets provides similar functionality through the<ui:include>
tag. The tag's src
attribute can be used to specify the path of a Facelets page to be included at request time. This technique enables us to externalize common view elements such as headers and footers as separate files and to reuse these by including them in other pages throughout our application.
Including a header and footer
The following example demonstrates how to create a simple composite view using the SSI approach. The header and footer files are included to create a complete view.
include01.jsf
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd> <html xmlns=http://www.w3.org/1999/xhtml xmlns:h=http://java...