<?xml version="1.0" encoding="UTF-8"?>
<chapter>
  <chapterinfo>
    <keywordset>
      <keyword>a4j:loadScript</keyword>
    </keywordset>
  </chapterinfo>
     <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.LoadScript</entry>
          </row>
          <row>
            <entry>component-family</entry>
            <entry>org.ajax4jsf.LoadScript</entry>
          </row>
          <row>
            <entry>component-class</entry>
            <entry>org.ajax4jsf.component.html.HtmlLoadScript</entry>
          </row>
          <row>
            <entry>renderer-type</entry>
            <entry>org.ajax4jsf.LoadScriptRenderer</entry>
          </row>
        </tbody>
      </tgroup>
    </table>
  
  <section>
    <title>Creating on a page</title>
    <para>To create the simplest variant on a page use the following syntax:</para>

  <para>
      <emphasis role="bold">Example:</emphasis>
 </para>
    <programlisting role="XML"><![CDATA[<a4j:loadScript src="scripts/someScript.js"/>
]]></programlisting>
  </section>
  <section>
    <title>Creating the Component Dynamically Using Java</title>

  <para>
      <emphasis role="bold">Example:</emphasis>
 </para>
    <programlisting role="JAVA"><![CDATA[import org.ajax4jsf.component.html.HtmlLoadScript;
...
HtmlLoadScript myScript = new HtmlLoadScript();
...
]]></programlisting>
  </section>
  <section>
    <title>Key attributes and ways of usage</title>
    <para>
      As it was mentioned <link linkend="loadScript">above</link> this component returns its value as the value of 
      the <emphasis><property>&quot;src&quot;</property></emphasis> attribute passing it to the
    	 <code>getResourceURL()</code> method of the ViewHandler for this application, and passing 
    	 the result	through the <code>encodeResourceURL()</code> method of the ExternalContext.
    </para>
    <para>
    	It means that the Context is inserts automatically to the link. And calls
    	 like <code>resource://</code> is properly handled.
    </para>
    <para>
    	Except this - you may be free to put your script links right from the child 
    	page while using <property>facelets templates</property>.
    </para>
</section>

  <section>
    <title>Relevant resources links</title>
	<para>
	   <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/script.jsf?c=loadScript">Here</ulink> you can see the example of <emphasis role="bold"
	     ><property>&lt;a4j:loadScript&gt;</property></emphasis> usage and sources for the given example.
	</para>
  </section>

</chapter>   