[ajax4jsf-svn-commits] JBoss Ajax4JSF SVN: r303 - trunk/docs/userguide/en/src/main/docbook/included.

ajax4jsf-svn-commits at lists.jboss.org ajax4jsf-svn-commits at lists.jboss.org
Mon Jul 9 09:37:48 EDT 2007


Author: vkorluzhenko
Date: 2007-07-09 09:37:48 -0400 (Mon, 09 Jul 2007)
New Revision: 303

Modified:
   trunk/docs/userguide/en/src/main/docbook/included/jsFunction.xml
Log:
http://jira.jboss.com/jira/browse/RF-421
Improved discription for jsFunction. Added ways of usage and link to example.

Modified: trunk/docs/userguide/en/src/main/docbook/included/jsFunction.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/jsFunction.xml	2007-07-07 01:16:15 UTC (rev 302)
+++ trunk/docs/userguide/en/src/main/docbook/included/jsFunction.xml	2007-07-09 13:37:48 UTC (rev 303)
@@ -1,36 +1,36 @@
 <?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.ajax.Function</entry>
-          </row>
-          <row>
-            <entry>component-family</entry>
-            <entry>org.ajax4jsf.components.AjaxFunction</entry>
-          </row>
-          <row>
-            <entry>component-class</entry>
-            <entry>org.ajax4jsf.ajax.html.HtmlAjaxFunction</entry>
-          </row>
-          <row>
-            <entry>renderer-type</entry>
-            <entry>org.ajax4jsf.components.AjaxFunctionRenderer</entry>
-          </row>
-        </tbody>
-      </tgroup>
-    </table>
-  
+
+  <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.ajax.Function</entry>
+        </row>
+        <row>
+          <entry>component-family</entry>
+          <entry>org.ajax4jsf.components.AjaxFunction</entry>
+        </row>
+        <row>
+          <entry>component-class</entry>
+          <entry>org.ajax4jsf.ajax.html.HtmlAjaxFunction</entry>
+        </row>
+        <row>
+          <entry>renderer-type</entry>
+          <entry>org.ajax4jsf.components.AjaxFunctionRenderer</entry>
+        </row>
+      </tbody>
+    </tgroup>
+  </table>
+
   <section>
     <title>Creating on a page</title>
     <para>Simple component definition example:</para>
@@ -45,10 +45,9 @@
 <a4j:jsFunction data="#{bean.someProperty}" name="callScript" oncomplete="myScript(data.subProperty1, data.subProperty2)"/>
 ...]]>
 	</programlisting>
-	<para>
-		The script &quot;myScript&quot; will be called after <property>bean.someProperty</property> data 
-		will be returned from server(e.g. It&apos;ll be object with two subproperties).  
-	</para>
+    <para> The script &quot;myScript&quot; will be called after
+      <property>bean.someProperty</property> data will be returned from server(e.g. It&apos;ll
+      be object with two subproperties). </para>
   </section>
   <section>
     <title>Dynamical creation of a component from Java code</title>
@@ -60,11 +59,55 @@
   </section>
   <section>
     <title>Key attributes and ways of usage</title>
-   		<para>
-   			As the component uses Ajax request to get data from server - it has all 
-   			common Ajax Action attributes. So, action and actionListener can be 
-   			invoked, and reRendering some parts of the page fired after calling 
-   			function.
-   		</para>
-   </section>
-</chapter>   
\ No newline at end of file
+    <para> As the component uses Ajax request to get data from server - it has all common Ajax
+      Action attributes. So, action and actionListener can be invoked, and reRendering some parts of
+      the page fired after calling function. </para>
+    <para> When using the <emphasis role="bold">
+        <property>&lt;a4j:jsFunction&gt;</property>
+      </emphasis> it&apos;s possible to initiate the AJAX request from the JavaScript and
+      perform partial update of a page and/or invoke the JavaScript function with data returned by
+      AJAX response. </para>
+    <programlisting role="XML"><![CDATA[...
+<body onload="callScript()">
+    ...
+    <h:form>
+    ...
+    <a4j:jsFunction name="callScript" data="#{bean.someProperty1 }
+                    "reRender="someComponent" oncomplete="myScript(data.subProperty1, data.subProperty2)">
+        <a4j:actionparam name="param_name" assignTo="#{bean.someProperty2}">
+        </a4j:actionparam>
+    </a4j:jsFunction>
+    ...
+    </h:form>
+    ...
+</body>
+...]]></programlisting>
+    <para> The <emphasis role="bold">
+        <property>&lt;a4j:jsFunction&gt;</property>
+      </emphasis> allows to use <emphasis role="bold">
+        <property>&lt;a4j:actionparam&gt;</property>
+      </emphasis> or pure <emphasis role="bold">
+        <property>&lt;f:param&gt;</property>
+      </emphasis> for passing any number of parameters of the JavaScript function into AJAX request.
+        <emphasis role="bold">
+        <property>&lt;a4j:jsFunction&gt;</property>
+      </emphasis> is similar to <emphasis role="bold">
+        <property>&lt;a4j:commandButton&gt;</property>
+      </emphasis>, but it could be activated from the JavaScript code. It allows to invoke some
+      server side functionality and use the returned data in the JavaScript function invoked from
+      &quot;oncomplete&quot; attribute. So it&apos;s possible to use <emphasis
+        role="bold">
+        <property>&lt;a4j:jsFunction&gt;</property>
+      </emphasis> instead of <emphasis role="bold">
+        <property>&lt;a4j:commandButton&gt;</property>
+      </emphasis>. You can put it anywhere, just don&apos;t forget to use
+      &lt;h:form&gt; … &lt;/h:form&gt; around it. </para>
+  </section>
+  <section>
+    <title>Relevant resources links</title>
+    <para> To see how <emphasis role="bold">
+        <property>&lt;a4j:jsFunction&gt;</property>
+      </emphasis> works on practice, look at a4j-jsFunction example from <ulink
+        url="http://labs.jboss.com/jbossajax4jsf/demo/index.html">here</ulink>.</para>
+  </section>
+</chapter>




More information about the ajax4jsf-svn-commits mailing list