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
Selected ui:fragment
  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:fragment

ui:fragment

The UI Fragment tag inserts a new UIComponent instance into the JSF component tree. Any components or content fragments outside this tag will be included by the Facelets view handler. Any components or content fragments within this tag will be added to the component tree as children of this component instance. See also ui:component.

fragment.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.sun.com/jsf/html" 
      xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head />
<body>
<h:form>
	This text will be included.
	<ui:fragment binding="#{myController.component}">
		<div id="message">
			Hello World!
		</div>
	</ui:fragment>
	This text will be included.
</h:form>
</body>
</html>
This example was formatted by JSFToolbox for Dreamweaver.

Rendered Output

Rendered ui:fragment tag

HTML Output

This text will be included.
<div id="message">Hello World!</div>
This text will be included.

Tag Attributes

binding Expression
 
Binds the component to a backing bean property, as specified in the JSF specification.
id Text
 
The identifier of the component that JSF inserts into the component tree. If an identifier is not explicitly specified by the page author, JSF will assign an identifier based on the algorithm that it uses for all components.