JBoss.org Community Documentation

- Prev
- Next

## 6.16. < a4j:page >

### 6.16.1. Description

<a4j:page> is used for solving of incompatibility problems in early Ajax4jsf versions. The component encodes the full html page structure.

Table 6.31. 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 | The attribute takes a value-binding expression for a component property of a backing bean
contentType | Set custom mime content type to response
dir | 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 | 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 | Code describing the language used in the generated markup for this component
namespace | Set html element default namespace
onload | JavaScript code to execute on a page load.
onunload | JavaScript code to execute on a page unload.
pageTitle | String for output as a page title.
rendered | 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 | CSS style(s) is/are to be applied when this component is rendered
styleClass | Corresponds to the HTML class attribute
title | Advisory title information about markup elements generated for this component

Table 6.32. 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.16.2. Creating on a page

This component should be defined as a child component for <f:view>:

    <f:view>

     <a4j:page>

         <f:facet name="head">

             <!--...Head Content here-->

         </f:facet>

       <!--...Page Content here-->

     </a4j:page>

    </f:view>

### 6.16.3. Creating the Component Dynamically Using Java

Example:

    import org.ajax4jsf.component.html.HtmlPage;

    ...

    HtmlPage myPage = new HtmlPage();

    ...

### 6.16.4. Key attributes and ways of usage

The component is mostly used to solve the following problem with MyFaces for erlier Ajax4jsf versions: in MyFaces <f:view> doesn't get control over the RENDER_RESPONSE phase, thus Ajax can't get control and make a response also. To avoid this problem it was necessary to use <a4j:page> on a page round the Ajax updatable area. In the last versions of both frameworks the problem is successfully fixed and no <a4j:page> usage is required.

The component is rendered as a full HTML page template as it is shown in the example. The head section is defined with the help of the corresponding "head" facet. You do not need to use "body" facet in order to define first body section. The second and more body sections is defined with the help of the corresponding "body" facet.

The attribute "format" defines page layout format for encoding DOCTYPE.

The attribute "pageTitle" is rendered as title section.

Example:

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

        <f:facet name="head">

            <!--Head Content here-->

        </f:facet>

       <!--Page Content Here-->

    </a4j:page>

This structure is rendered as:

Example:

    <!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.16.5. Relevant resources links

Here you can found some additional information for <a4j:page> component usage.

- Prev6.15. < a4j:outputPanel >
- Top of page
- Front page
- Next6.17. < a4j:poll >