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
  ui:include
  ui:insert
Selected 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:param

ui:param

The UI Param tag is used to pass objects as named variables between Facelets. The name attribute of the UI Param tag should match the name attribute of a ui:define tag contained in a ui:composition or ui:decorate in the template page receiving the object. The UI Param tag can also be used to pass objects to another page by using the ui:include tag.

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:h="http://java.sun.com/jsf/html" 
      xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head />
<body>
<h:form>
	<ui:include src="hello.xhtml">
		<ui:param name="greeting" value="#{messageController.message}"/>
	</ui:include>
</h:form>
</body>
</html>
This example was formatted by JSFToolbox for Dreamweaver.

hello.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><h:outputText value="#{greeting}" /></h2>
</ui:composition>
</body>
</html>
This example was formatted by JSFToolbox for Dreamweaver.

Java Code

package com.mycompany.controller;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

@ManagedBean
@RequestScoped
public class MessageController {

	private String message = "Hello, World!";

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

}

Rendered Output

Rendered ui:param tag

HTML Output

<h2>Hello World</h2>

Tag Attributes

name Text
Required
The name of the parameter.
value Text
Required
The value of the parameter. Notice that this attribute's value can be an EL expression, which means that you can pass objects to either an included file or a template.