<?xml version='1.0' encoding='UTF-8'?>
<chapter>
  <chapterinfo>
    <keywordset>
      <keyword>a4j:include</keyword>
    </keywordset>
  </chapterinfo>
     <para><table frame="all">
         <title>Component identification parameters</title>
        <tgroup cols="2">
	  <thead>
            <row>
                <entry>Name</entry>
                <entry>Value</entry>
            </row>
        </thead>
          <tbody>
            <row>
              <entry>component-type</entry>
              <entry>org.ajax4jsf.Include</entry>
            </row>
            <row>
              <entry>component-family</entry>
              <entry>javax.faces.Output</entry>
            </row>
            <row>
              <entry>component-class</entry>
              <entry>org.ajax4jsf.component.html.Include</entry>
            </row>
            <row>
              <entry>renderer-type</entry>
              <entry>org.ajax4jsf.components.AjaxIncludeRenderer</entry>
            </row>
          </tbody>
        </tgroup>
      </table></para>
  
  <section>
    <title>Creating on a page</title>
    <para>To use the component, it&apos;s necessary to place the following strings on a page:</para>

  <para>
      <emphasis role="bold">Example:</emphasis>
 </para>
     <programlisting role="XML"><![CDATA[<h:panelGroup id="wizard">
		<a4j:include  viewId="/pages/include/first.xhtml" />
</h:panelGroup>
]]></programlisting>
<para>For navigation inside a page defined in viewId any components responsible for Ajax requests to the server generation are used.</para>
<para>For example, the following component on a page <code>&quot;/pages/include/first.xhtml&quot;</code></para>

  <para>
      <emphasis role="bold">Example:</emphasis>
 </para>
<programlisting role="XML"><![CDATA[...
<a4j:commandButton action="next" reRender="wizard"/>
...
]]></programlisting>
<para>And in faces-config it's defined:</para>

  <para>
      <emphasis role="bold">Example:</emphasis>
 </para>
<programlisting role="XML"><![CDATA[<navigation-rule>
  <from-view-id>/pages/include/first.xhtml</from-view-id>
  <navigation-case>
   <from-outcome>next</from-outcome>
   <to-view-id>/pages/include/second.xhtml</to-view-id>
  </navigation-case>
 </navigation-rule>
]]></programlisting>
<para>In this case after a click on a button defined inside <code>&quot;first.xhtml&quot;</code> view, navigation is performed after an Ajax request (the same as standard JSF one) only inside this view.</para>
 </section>
  <section>
    <title>Creating the Component Dynamically Using Java</title>
    <programlisting role="JAVA"><![CDATA[<import org.ajax4jsf.component.html.Include;
...
Include myInclude = new Include();
...
]]></programlisting>
<para>If <emphasis role="bold">
        <property>&lt;a4j:include&gt;</property>
      </emphasis> is defined this way, any Ajax request returning outcome inside generates navigation with this <emphasis role="bold">
        <property>&lt;a4j:include&gt;</property>
      </emphasis>.</para>
<para>Ajax Action for navigation implementation inside view must be placed inside <emphasis role="bold">
        <property>&lt;a4j:include&gt;</property>
      </emphasis> pages. Navigation defined by these pages is applied to the <emphasis role="bold">
        <property>&lt;a4j:include&gt;</property>
      </emphasis> element current for them.</para>
<para>As in the general case for Ajax Action component, if the <emphasis role="bold">
        <property>&lt;a4j:action&gt;</property>
      </emphasis>component inside <emphasis role="bold">
        <property>&lt;a4j:include&gt;</property>
      </emphasis>returns outcome defined as <emphasis role="bold">
        <property>&lt;redirect/&gt;</property>,
      </emphasis> Ajax submit is performed with navigation of the whole page and not only of the current view. 
</para>
</section>

  <section>
    <title>Relevant resources links</title>
    <para><ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/include.jsf?c=include"
      >Here</ulink> you can see the example of <emphasis role="bold"
        ><property>&lt;a4j:include&gt;</property></emphasis> usage and sources for the given example. </para>
	<para> 
	Some additional information can be found on the <ulink url="http://jboss.com/index.html?module=bb&amp;op=viewtopic&amp;t=104158">Ajax4Jsf Users Forum</ulink>.
	</para><!--
	To see how component works on practice, look at a4j-include example from 
	<ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/include.jsf?c=include">RichFaces Live Demo</ulink>.	 -->
  </section>
</chapter>