Developing Web 2.0 applications
with JavaServerFaces
and Dreamweaver
>> Just Became Easier
Documentation
Search
  1. Introduction
  2. Getting Started
  3. Facelets Concepts
  4. Document Types
  5. Design View
  6. Code View Support
  7. Keyboard Shortcuts
  8. Tag Object Toolbars
  9. Property Inspectors
  10. Facelets Tag Reference
Facelets UI Tag Library
  ui:component
  ui:composition
  ui:debug
  ui:decorate
  ui:define
  ui:fragment
Selected ui:include
  ui:insert
  ui:param
  ui:remove
  ui:repeat
If you like this documentation, please take a look at my book:

10. Facelets UI Tag Reference

Documentation > Facelets > Facelets Tag Reference > Facelets UI Tag Library > ui:include

ui:include

The UI Include tag is a server-side include tag for Facelets. It simply includes the document pointed to by the "src" attribute as part of the current JSF page. The included document should use a component or composition tag to trim unnecessary markup, or it may simply contain a fragment of XHTML or XML to be included.

JSF Example

<!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:f="http://java.sun.com/jsf/core" 
      xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head />
<body>
<f:view>
	<h:form>
		<ui:include src="header.xhtml" />
		Body text here.
	</h:form>
</f:view>
</body>
</html>
This example was formatted by JSFToolbox for Dreamweaver.

header.xhtml

<!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.sun.com/jsf/html" 
      xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head />
<body>
<ui:composition>
	<h2>Our Company</h2>
</ui:composition>
</body>
</html>
This example was formatted by JSFToolbox for Dreamweaver.

Rendered Output

Rendered ui:include tag

HTML Output

<h2>Our Company</h2>
Body text here.

Tag Attributes

src Text
Required
The filename of an XHTML page to include. The filename is relative to the XHTML page that was originally loaded.