<?xml version="1.0" encoding="UTF-8"?>
<chapter>
     <table>
	  <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.components.KeepAlive</entry>
          </row>
          <row>
            <entry>component-family</entry>
            <entry>org.ajax4jsf.components.AjaxKeepAlive</entry>
          </row>
          <row>
            <entry>component-class</entry>
            <entry>org.ajax4jsf.components.AjaxKeepAlive</entry>
          </row>
        </tbody>
      </tgroup>
    </table>
  
  <section>
    <title>Creating on a page</title>

    <para>Simple Component definition on a page:</para>

	  <para>
		  <emphasis role="bold">Example:</emphasis>  </para>
		<programlisting role="XML"><![CDATA[<a4j:keepAlive beanName = "#{myClass.testBean}"/>]]></programlisting>
	
  </section>
  
  <section>
    <title>Dynamical creation of a component from Java code</title>

	  <para>
		  <emphasis role="bold">Example:</emphasis>  </para>	

	  <programlisting role="JAVA"><![CDATA[import org.ajax4jsf.ajax.AjaxKeepAlive;
...
AjaxKeepAlive myKeepAlive = new AjaxKeepAlive();
...
		]]></programlisting>
		
  </section>

  <section>
    <title>Key attributes and ways of usage</title>
	<para>
	 If a managed bean is declared with 'request' scope in the configuration file with the help of 'managed-bean-scope' tag then the life-time of
	 this bean instance is valid only for the current request.
	 Any attempts to make a reference to the bean instance after the request end will throw in Illegal Argument Exception by the server.
	To avoid these kinds of Exception, component
	<emphasis role="bold"><property>&lt;a4j:keepAlive&gt;</property>
	</emphasis>  is used to maintain the state of the whole bean object among subsequent request. 
	</para>

	<para><emphasis role="bold">Example:</emphasis></para>

	<programlisting role="XML"><![CDATA[<a4j:keepAlive beanName = "#{myClass.testBean}"/>]]></programlisting>

	<para>
	Note that the attribute 'beanName' must point to a legal jsf EL expression which resolves to a managed mean instance. For example for
	the above code the class definition may look like this:</para>

	<programlisting role="XML"><![CDATA[
class MyClass{
	...
	private TestBean testBean;
	// Getters and Setters for testBean.
	...
}
	]]></programlisting>


  </section>
  <section>
    <title>Relevant resources links</title>
	<para>
	  Some additional information about usage of component can be found <ulink url="http://jboss.com/index.html?module=bb&amp;op=viewtopic&amp;t=104989">here.
	</ulink>
	</para>
  </section>
</chapter>   