Create new RichFaces Documentation Jira issue

This will launch the RichFaces Jira page - to complete your feedback please login if needed, and submit the Jira.

JBoss.orgCommunity Documentation

6.5.1.  < a4j:page > available since 3.0.0

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.47. a4j : page attributes

Attribute Name Description
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
binding JSF: The attribute takes a value-binding expression for a component property of a backing bean
contentTypeSet custom mime content type to response
dirHTML: Direction 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
id JSF: Every 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
langHTML: Code describing the language used in the generated markup for this component
namespaceSet html element default namespace
onloadThe client-side script method to be called before a page is loaded
onunloadThe client-side script method to be called when a page is unloaded
pageTitleString for output as a page title.
rendered JSF: If "false", this component is not rendered
selfRenderedif "true", self-render subtree at InvokeApplication ( or Decode, if immediate property set to true ) phase
styleHTML: 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.
titleHTML: Advisory title information about markup elements generated for this component

Table 6.48. 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

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>

Example:

import org.ajax4jsf.component.html.HtmlPage;

...
HtmlPage myPage = new HtmlPage();
...

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>

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