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 NameDescription
ajaxListenerMethodExpression 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
bindingThe attribute takes a value-binding expression for a component property of a backing bean
contentTypeSet custom mime content type to response
dirDirection indication for text that does not inherit directionality. Valid values are "LTR" (left-to-right) and "RTL" (right-to-left)
formatPage layout format ( html, xhtml, html-transitional, html-3.2 ) for encoding DOCTYPE, namespace and Content-Type definitions
idEvery component may have a unique id that is automatically created if omitted
immediateFlag 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
langCode describing the language used in the generated markup for this component
namespaceSet html element default namespace
onloadJavaScript code to execute on a page load.
onunloadJavaScript code to execute on a page unload.
pageTitleString for output as a page title.
renderedIf "false", this component is not rendered
selfRenderedif "true", self-render subtree at InvokeApplication ( or Decode, if immediate property set to true ) phase
styleCSS style(s) is/are to be applied when this component is rendered
styleClassCorresponds to the HTML class attribute
titleAdvisory title information about markup elements generated for this component

Table 6.32. Component identification parameters

NameValue
component-typeorg.ajax4jsf.components.Page
component-familyorg.ajax4jsf.components.AjaxRegion
component-classorg.ajax4jsf.component.html.HtmlPage
renderer-typeorg.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.