### Create new RichFaces Documentation Jira issue

Summary
255 characters left
Description
Environment
This will launch the RichFaces Jira page - to complete your feedback please login if needed, and submit the Jira.

JBoss.org Community Documentation

- Prev
- Next

### 6.5.1. < a4j:page > available since 3.0.0

expand all

#### 6.5.1.1. Description

The <a4j:page> component encodes the full HTML-page structure and used for solving some incompatibility in JSP environment with MyFaces in early Ajax4Jsf versions.

Table 6.46. a4j : page attributes

Attribute Name | Description
--- | ---
ajaxListener | MethodExpression representing an action listener method that will be notified when this component is activated by the ajax Request and handle it. The expression must evaluate to a public method that takes an AjaxEvent parameter, with a return type of void
binding | JSF: The attribute takes a value-binding expression for a component property of a backing bean
contentType | Set custom mime content type to response
dir | HTML: Direction indication for text that does not inherit directionality. Valid values are "LTR" (left-to-right) and "RTL" (right-to-left)
format | Page layout format ( html, xhtml, html-transitional, html-3.2 ) for encoding DOCTYPE, namespace and Content-Type definitions
id | JSF: Every component may have a unique id that is automatically created if omitted
immediate | Flag indicating that, if this component is activated by ajaxrequest, notifications should be delivered to interested listeners and actions immediately (that is, during Apply Request Values phase) rather than waiting until Invoke Application phase
lang | HTML: Code describing the language used in the generated markup for this component
namespace | Set html element default namespace
onload | The client-side script method to be called before a page is loaded
onunload | The client-side script method to be called when a page is unloaded
pageTitle | String for output as a page title.
rendered | JSF: If "false", this component is not rendered
selfRendered | if "true", self-render subtree at InvokeApplication ( or Decode, if immediate property set to true ) phase
style | HTML: CSS style rules to be applied to the component
styleClass | JSF: Assigns one or more CSS class names to the component. Corresponds to the HTML "class" attribute.
title | HTML: Advisory title information about markup elements generated for this component

Table 6.47. Component identification parameters

Name | Value
--- | ---
component-type | org.ajax4jsf.components.Page
component-family | org.ajax4jsf.components.AjaxRegion
component-class | org.ajax4jsf.component.html.HtmlPage
renderer-type | org.ajax4jsf.components.AjaxPageRenderer

#### 6.5.1.2. Creating the component with a Page Tag

The <a4j:page> should be the only child of <f:view> :

    <f:view>

          <a4j:page>

                <f:facet name="head">

                      <!--Head Content-->

                </f:facet>

                <!--Page Content-->

          </a4j:page>

    </f:view>

#### 6.5.1.3. Creating the Component Dynamically Using Java

Example:

    import org.ajax4jsf.component.html.HtmlPage;

    ...

    HtmlPage myPage = new HtmlPage();

    ...

#### 6.5.1.4. Details of usage

The component solves the problem with MyFaces for early Ajax4Jsf versions: in MyFaces implementation the <f:view> JSP tag doesn't get control for encoding contents during the RENDER_RESPONSE phase, thus Ajax can't neiher get a control nor make a response. The <a4j:page> solves this problem by wrapping the Ajax updatable areas. In the last versions of both frameworks the problem is successfully fixed and no <a4j:page> usage is required.

The component uses facet "head" for defining the contents corresponding to the HTML HEAD. There is no need to use "body" facet in order to define first body section. The attribute "format" defines page layout format for encoding DOCTYPE. The attribute "pageTitle" is rendered as title section.

According to the described above, the component defined at page as following

    <a4j:page format="xhtml" pageTitle="myPage">

          <f:facet name="head">

                <!--Head Content here-->

          </f:facet>

          <!--Page Content Here-->

    </a4j:page>

will be rendered on a page as

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    <html>

        <head>

            <title>myPage</title>

            <!--Head Content here-->

        </head>

        <body>

            <!--Page Content Here-->

        </body>

    </html>

#### 6.5.1.5. Facets

Table 6.48. Facets

Facet name | Description
--- | ---
head | Defines a head content

#### 6.5.1.6. Relevant resources links

Vizit the AjaxPage page at RichFaces LiveDemo for examples of component usage and their sources.

- Prev6.5. Ajax Miscellaneous
- Top of page
- Front page
- Next6.5.2. < a4j:portlet > ...