Author: SergeySmirnov
Date: 2007-07-24 13:09:24 -0400 (Tue, 24 Jul 2007)
New Revision: 1827
Added:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/ajaxAttributes/usage.xhtml
Log:
attributes
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/ajaxAttributes/usage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/ajaxAttributes/usage.xhtml
(rev 0)
+++
trunk/samples/richfaces-demo/src/main/webapp/richfaces/ajaxAttributes/usage.xhtml 2007-07-24
17:09:24 UTC (rev 1827)
@@ -0,0 +1,107 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/ajax"
+
xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+ <ui:composition template="/templates/component-sample.xhtml">
+ <ui:define name="sample">
+
+ <p>This section overview the attributes that are common for the Ajax components
+ such as a4j:support, a4j:commandButton, a4j:jsFunction, a4j:poll, a4j:push and so
+ on. Also, most RichFaces components with built-in Ajax support have those
+ attribute for the similar purpose.
+ </p>
+ <p>
+ Attributes of Ajax component is a way how RichFaces exposes its features.
+ Most of the attributes have an default value. So, you can start working with
RichFaces
+ without knowing the usage of those attribute. However, using them allows to
+ tune the required Ajax behavoir very smoothly.
+ </p>
+ <h1 class="hsample">Re-Rendering</h1>
+ <p>
+ <b>reRender</b> is a key attribute. It allows to point to the area(s) on
the page that
+ should be updated as a response on Ajax interaction. The value of the reRender
+ attribute is an id of the the JSF component or the id list. This is a simple example:
+
+ <div class="esample">
+ <pre>
+...
+<a4j:commandButton value="update"
reRender="<b>infoBlock</b>" />
+....
+<h:panelGrid id="<b>infoBlock</b>">
+.....
+</h:panelGrid>
+.....
+ </pre>
+ </div>
+ </p>
+ <p>
+ reRender uses <a target="_blank"
href="http://java.sun.com/javaee/javaserverfaces/1.2_MR1/docs/api/ja...
+ UIComponent.findComponent()</a> algorithm (with some additional exceptions)
+ to find the component in the component tree. As you see, the algorithm presume
+ several steps. Each other step is used if the previous step is not succeseful.
+ Therefore, from your side, you can shortcut the way how fast the component is
+ found if you mentioned it more precisely. The following example show the difference
+ in approaches (both buttons will work successfully):
+ <div class="esample">
+ <pre>
+.....
+<h:form id="form1">
+ ....
+ <a4j:commandButton value="Usual Way"
reRender="<b>infoBlock</b>, <b>infoBlock2</b>"
/>
+ <a4j:commandButton value="Shortcut"
reRender="<b>:infoBlockl</b>,<b>:sv:infoBlock2</b>"
/>
+.....
+</h:form>
+<h:panelGrid id="<b>infoBlock</b>">
+.....
+</h:panelGrid>
+.....
+<f:subview id="<b>sv</b>">
+<h:panelGrid id="<b>infoBlock2</b>">
+.....
+</h:panelGrid>
+.....
+</f:subview>
+ </pre>
+ </div>
+ </p>
+ <p>
+ You can use JSF EL expression as a value of the reRender attribute. It might be
property of
+ types Set, Collection, Array or simple String. The EL for reRender is resolved right
before the
+ Render Response phase. So, you can calculate what should be re-rendered on any
previous
+ phase during the Ajax request processing.
+ </p>
+ <p>
+ <b>ajaxRendered</b> attribute of the a4j:outputPanel set to true allows
to define the
+ area of the page that will be re-rendered even it is not pointed in the reRender
attribute
+ explicitly. It might be useful if you have a zone on the page that should be updated
as a
+ response on any Ajax request. For example, the following code allows to output the
error
+ messages independently what Ajax request causes the Validation phase failed.
+ </p>
+ <div class="esample">
+ <pre>
+<a4j:outputPanel ajaxRendered="true">
+ <h:messages />
+</a4j:outputPanel>
+ </pre>
+ </div>
+ <p>
+ <b>limitToList</b> attribute allows to dismiss the behaviour of the
a4j:outputPanel's ajaxRendered
+ attribute. limitToList = "false" means to update only the area(s) that
mentioned in the
+ reRender attribute explicitly. All output panels with ajaxRendered="true"
will be ignored.
+ </p>
+
+
+ <div class="sample-container" >
+ </div>
+
+
+ </ui:define>
+ <ui:define name="sources">
+ Here is a fragment of page sources for the given example:
+ <iframe
src="${facesContext.externalContext.requestContextPath}/richfaces/ajaxAttributes/source/usage.html"
class="source_frame"/>
+ </ui:define>
+ </ui:composition>
+</html>
Property changes on:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/ajaxAttributes/usage.xhtml
___________________________________________________________________
Name: svn:mime-type
+ text/plain