Author: smukhina
Date: 2007-08-06 07:03:43 -0400 (Mon, 06 Aug 2007)
New Revision: 2070
Modified:
trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml
trunk/docs/userguide/en/src/main/docbook/modules/RFCsetwebappl.xml
Log:
http://jira.jboss.com/jira/browse/RF-522
Guides chapters merging
Modified: trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml 2007-08-06
10:39:16 UTC (rev 2069)
+++ trunk/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml 2007-08-06
11:03:43 UTC (rev 2070)
@@ -14,337 +14,8 @@
</keywordset>
</chapterinfo>
- <title>Architecture Overview</title>
+ <title>Skinnability</title>
- <section id="AjaxProcessing">
- <?dbhtml filename="AjaxProcessing.html"?>
- <title>Ajax Processing</title>
-
- <para>RichFaces is based on the Ajax4jsf framework, so
- <property>AJAX</property> request support is performed with this
- framework.</para>
-
-<section>
- <title>Basic concepts of the Ajax4jsf Framework</title>
- <section id="introToBasics">
- <?dbhtml filename="introToBasics.html"?>
- <title>Introduction</title>
- <para>The framework is implemented as a component library which adds AJAX
capability into existing
- pages, so you don't need to write any JavaScript code or to replace
existing
- components with new AJAX widgets. <property>Ajax4jsf</property> enables
page-wide AJAX support instead of the
- traditional component-wide support. So, you can define the event on the page that
- invokes an AJAX request and the areas of the page that should be synchronized with
the JSF
- Component Tree after the AJAX request changes the data on the server according to
the
- events fired on the client.</para>
- <para>Next Figure shows how it works:</para>
- <figure>
- <title>Request Processing flow</title>
- </figure>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/newpic1.jpg"/>
- </imageobject>
- </mediaobject>
- <para><property>Ajax4jsf</property> allows to define (by means of
JSF tags) different parts of a JSF page you
- wish to update with an AJAX request and provide a few options to send AJAX
requests to
- the server. Also JSF page doesn't change from a
"regular" JSF
- page and you don't need to write any JavaScript or XMLHttpRequest
objects by hands, everything is done automatically.</para>
- </section>
- <section id="ArchitectureOverview1">
- <?dbhtml filename="ArchitectureOverview.html"?>
- <title>Architecture Overview</title>
- <para>Next figure lists several important elements of the
<property>Ajax4jsf</property> framework</para>
- <figure>
- <title>Ajax4jsf component structure</title>
- </figure>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/newpic2.jpg"/>
- </imageobject>
- </mediaobject>
- <formalpara>
- <title>Ajax Filter.</title>
- <para>To get all benefits of <property>Ajax4jsf</property>, you
should register an AJAX Filter in web.xml
- file of your application.The AJAX Filter recognizes multiple request types. The
sequence diagram on Figure 3
- shows the difference in processing of a "regular" JSF request and
an AJAX request.</para>
- </formalpara>
- <para>In the first case the whole JSF tree will be encoded,
- in the second one option it depends on the "size" of the AJAX
region (you can define AJAX region
- by using the <emphasis
role="bold"><property><a4j:region></property></emphasis>).
As you can see, in the second case the filter parses
- the content of an AJAX response before sending it to the client side.</para>
- <para>Have a look at the next picture to understand these two
ways:</para>
- <figure>
- <title>Request Processing sequence diagram</title>
- </figure>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/newpic3.jpg"/>
- </imageobject>
- </mediaobject>
- <para>In both cases, the information about required static or dynamic resources
that your application
- requests is registered in the ResourseBuilder class.</para>
- <para>When a request for a resource comes (Figure 4), the AJAX filter checks
the Resource Cache
- for this resource and if it is there, the resource is sent to the client.
Otherwise,
- the filter searches for the resource among those that are registered by the
- ResourceBuilder. If the resource is registered, the AJAX filter will send a request
to the
- ResourceBuilder to create (deliver) the resource.</para>
- <para>Next Figure shows the ways of resource request processing.</para>
- <figure>
- <title>Resource request sequence diagram</title>
- </figure>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/newpic4.jpg"/>
- </imageobject>
- </mediaobject>
- <formalpara>
- <title>AJAX Action Components</title>
- <para>
- There are four AJAX Action Components: AjaxCommandButton, AjaxCommandLink,
AjaxPoll and AjaxSupport.
- You can use them to send AJAX requests from the client side.
- </para>
- </formalpara>
- <formalpara>
- <title>AJAX Containers</title>
- <para>
- AjaxContainer is an interface that describes an area on your JSF page that should
be decoded
- during an AJAX request. AjaxViewRoot and AjaxRegion are implementations of this
interface.
- </para>
- </formalpara>
- <formalpara>
- <title>JavaScript Engine</title>
- <para><property> Ajax4jsf</property> JavaScript Engine runs on
the client-side. It knows how to update different areas
- on your JSF page based on the information from the Ajax response. Do
- not use this JavaScript code directly, as it is available automatically.
- </para>
- </formalpara>
- </section>
- <section id="LimitationsAndRules">
- <?dbhtml filename="LimitationAndRules.html"?>
- <title>Limitations and Rules</title>
- <para>In order to create AJAX4JSF applications properly, keep the following
points in mind:</para>
- <itemizedlist>
- <listitem>
- The AJAX framework should not append or delete, but only replace elements on the
page. For successful updates, an element with the same ID as in the response must exist on
the page. If you'd like to append any code to a page, put in a placeholder for it
(any empty element). For the same reason, it's recommended to place messages in
the<emphasis >
- <property>"AjaxOutput"</property>
- </emphasis> component (as no messages is also a message).
- </listitem>
- <listitem>
- Don't use <emphasis role="bold">
- <property><f:verbatim></property>
- </emphasis> for self-rendered containers, since this component is
transient and not saved in the tree.
- </listitem>
- <listitem>
- AJAX requests are made by XMLHttpRequest functions in XML format, but this XML
bypasses most validations and the corrections that might be made in a browser. So, create
only a strict standards-compliant code for HTML and XHTML, without skipping any required
elements or attributes. Any necessary XML corrections are automatically made by the XML
filter on the server, but lot's of unexpected effects can be produced by an
incorrect HTML code.
- </listitem>
- </itemizedlist>
- </section>
- <section id="HowTo...">
- <?dbhtml filename="HowTo.html"?>
- <title>How To...</title>
- <section id="SendAnAJAXRequest">
- <?dbhtml filename="SendAnAJAXRequest.html"?>
- <title>Send an AJAX request</title>
- <para>There are different ways to send AJAX requests from your JSF page. You
may use
- <emphasis
role="bold"><property><a4j:commandButton></property></emphasis>,
<emphasis role="bold">
- <property><a4j:commandLink></property>, <emphasis
role="bold"><property><a4j:poll></property></emphasis>
- </emphasis> or <emphasis role="bold">
- <property><a4j:support></property>
- </emphasis> tags.
- </para>
- <para>All these tags hide the usual JavaScript activities that are required
for an XMHttpRequest
- object building and an AJAX request sending. Also, they allow you to decide
which components of
- your JSF page are to be re-rendered as a result of the AJAX response (you can
list the
- IDs of these components in the "reRender" attribute).
- </para>
- <para>
- <emphasis role="bold">
- <property><a4j:commandButton></property>
- </emphasis> and <emphasis role="bold">
- <property><a4j:commandLink></property>
- </emphasis> tags are used to send an AJAX
- request on "onclick" JavaScript event.
- </para>
- <para>
- <emphasis role="bold">
- <property><a4j:poll></property>
- </emphasis> tag is used to send an AJAX
- request periodically using a timer.
- </para>
- <para>The <emphasis role="bold">
- <property><a4j:support></property>
- </emphasis> tag allows you to add AJAX functionality to standard JSF
components
- and send AJAX request onto a chosen JavaScript event:
"onkeyup", "onmouseover",
- etc.
- </para>
- <para>Most important attributes of components that provide AJAX request
calling features are:</para>
- <itemizedlist>
- <listitem>
- <emphasis >
- <property>"reRender"</property>
- </emphasis>attribute as it was mentioned <link
linkend="SendAnAJAXRequest">before</link> specifies components to be
reRendered
- after AJAX response. The attribute can be specified using EL expression and
formed dynamicaly on the
- server side (see <ulink url="index.html#FAQ">FAQ
chapter</ulink>).
- </listitem>
- <listitem>
- <emphasis >
- <property>"RequestDelay"</property>
- </emphasis> attribute is used for a requests frequency regulation.
- </listitem>
- </itemizedlist>
- <programlisting role="XML"><![CDATA[<h:inputText
size="50" value="#{bean.text}">
- <a4j:support event="onkeyup" RequestDelay="3"/>
-</h:inputText>]]></programlisting>
- <para>So every next request from the frequent keyboard events will be
delayed
- on 3 ms to reduce the number of requests.
- </para>
- <itemizedlist>
- <listitem>
- <emphasis >
- <property>"EventsQueue"</property>
- </emphasis> is a queue that stores the next request.
- </listitem>
- <listitem>
- <emphasis >
- <property>"LimitToList"</property>
- </emphasis> attribute is used to regulate updatable regions. Setting
- it to true limits the updatable areas only to ones specified in a
- reRender list, in other case all Output Panels of the region are updated.
- </listitem>
- <listitem> <emphasis >
- <property>"ajaxSingle"</property>
- </emphasis> attributes specify regions to be sent with a request,
- if "false" it is a full region, in other case
it's is only a control caused
- event.
-</listitem>
- </itemizedlist>
- </section>
- <section id="DecideWhatToSend">
- <?dbhtml filename="DecideWhatToSend.html"?>
- <title>Decide What to Send</title>
- <para>You may describe a region on the page you wish to send to the server,
in this way you can
- control what part of the JSF View is decoded on the server side when you send
an
- AJAX request.
- </para>
- <para>The easiest way to describe an AJAX region on your JSF page is to do
nothing,
- because the content between the <emphasis role="bold">
- <property><f:view></property>
- </emphasis> and <emphasis role="bold">
- <property></f:view></property>
- </emphasis> tags is considered
- the default AJAX region.
- </para>
- <para>You may define multiple AJAX regions on the JSF page (they can even be
nested) by using
- the <emphasis role="bold">
- <property><a4j:region></property>
- </emphasis> tag.
- </para>
- <para>If you wish to render the content of an AJAX response outside of the
active region then
- the value of the "renderRegionOnly" attribute should be set
to "false". Otherwise, your
- AJAX updates are limited to elements of the active region.
- </para>
- </section>
- <section id="DecideWhatToChange">
- <?dbhtml filename="DecideWhatToChange.html"?>
- <title>Decide What to Change</title>
- <para>Using IDs in the "reRender" attribute to define
"AJAX zones" for update works fine in
- many cases.
- </para>
- <para>But you can not use this approach if your page contains, e.g. a
<emphasis
role="bold"><property><f:verbatim></property></emphasis>
- tag and you wish to update its content on an AJAX response.
- </para>
- <para>The problem with the <emphasis role="bold">
- <property><f:verbatim/></property>
- </emphasis> tag as described above is related to the
- value of the transientFlag of JSF components. If the value of this flag is
true, the
- component must not participate in state saving or restoring of process.
- </para>
- <para>In order to provide a solution to this kind of problems, Ajax4jsf uses
the concept of
- an output panel that is defined by the <emphasis role="bold">
- <property><a4j:outputPanel></property>
- </emphasis> tag. If you put a <emphasis
role="bold"><property><f:verbatim></property></emphasis>
- tag inside of the output panel, then the content of the <emphasis
role="bold">
- <property><f:verbatim/></property>
- </emphasis> tag and content of
- other panel's child tags could be updated on AJAX response. There are
two ways to
- control this:
- <itemizedlist>
- <listitem>
- By setting the "ajaxRendered" attribute value to
"true".
-</listitem>
- <listitem>
- By setting the "reRender" attribute value of an Action
Component to the output panel ID.
-</listitem>
- </itemizedlist>
- </para>
- </section>
- </section>
- <section id="RequestErrorsAndSessionExpirationHandling">
- <?dbhtml filename="RequestErrorsAndSessionExpirationHandling.html"?>
- <title>Request Errors and Session Expiration Handling</title>
- <para>Ajax4jsf allows to redefine standard handlers responsible for processing of
different exceptional situations. It helps to define own JavaScript, which is executed
when this situations occur.</para>
- <section id="RequestErrorsHandling">
- <?dbhtml filename="RequestErrorsHandling.html"?>
- <title>Request Errors Handling</title>
- <para>To execute your own code on the client in case of an error during AJAX
request, it's necessary to redefine the standard "A4J.AJAX.onError "
method:</para>
- <programlisting role="JAVA"><![CDATA[A4J.AJAX.onError =
function(req,status,message) {
- // Custom Developer Code
-};]]></programlisting>
- <para>The function defined this way accepts as parameters:</para>
- <itemizedlist>
- <listitem>req - a params string of a request that calls an
error</listitem>
- <listitem>status - the number of an error returned by the
server</listitem>
- <listitem>message - a default message for the given error</listitem>
- </itemizedlist>
- <para>Thus, it's possible to create your own handler that is called on
timeouts, inner server errors, and etc.</para>
- </section>
- <section id="SessionExpiredHandling">
- <?dbhtml filename="SessionExpiredHandling.html"?>
- <title>Session Expired Handling</title>
- <para>Beginning with Ajax4jsf version 1.0.5 it's possible to redefine
also the <emphasis >
- <property>"onExpired"</property>
- </emphasis> framework method that is called on the <emphasis >
- <property>"Session Expiration"</property>
- </emphasis> event.</para>
-
- <para>
- <emphasis role="bold">Example:</emphasis>
- </para>
- <programlisting role="JAVA"><![CDATA[A4J.AJAX.onExpired =
function(loc,expiredMsg){
- // Custom Developer Code
-};
-]]></programlisting>
-
-<para>Here the function receives in params:</para>
- <itemizedlist>
- <listitem>loc - URL of the current page (on demand can be updated)
</listitem>
- <listitem>expiredMsg - a default message on <emphasis >
- <property>"Session Expiration"</property>
- </emphasis>event.</listitem>
- </itemizedlist>
-<note>
-<title>Note:</title>
-Until the version 1.0.5 the method can't be redefined on <emphasis >
- <property>"Session Expiration"</property>,
- </emphasis> a confirmation dialog with a request for view reloading was always
called.
-</note>
- </section>
-</section>
-<section id="OtherRelevantResources">
- <title>Other Relevant Resources</title>
- <para><ulink
url="http://jsf.javabeat.net/articles/2007/06/introduction-to-ajax4j...
to Ajax4Jsf</ulink> by Shunmuga Raja</para>
-
-</section>
-
-</section>
-
- </section>
-
- <section id="Skinnability">
- <?dbhtml filename="Skinnability.html"?>
-
- <title>Skinnability</title>
-
<section id="WhySkinnability">
<?dbhtml filename="WhySkinnability.html"?>
<title>Why Skinnability</title>
@@ -851,4 +522,69 @@
</itemizedlist>
</section>
</section>
+
+<section><title>Built-in skinnability in Ajax4jsf</title>
+ <para>Ajax4jsf gives an opportunity to incorporate
<property>skinnability</property> into UI
+ design. With this framework you can easily use named skin parameters in
+ properties files to control the appearance of the skins that are applied
+ consistently to a whole set of components. You can look at examples of
+ predefined skins at:</para>
+ <simplelist>
+ <member>
+ <ulink
url="http://livedemo.exadel.com/richfaces-demo/">http://live...
+ </member>
+ </simplelist>
+ <para>
+ You may simply control the look-and-feel of your application by using the
<property>skinnability</property> service
+ of the Ajax4jsf framework. With the means of this service you can define the same
style for rendering
+ standard JSF components and custom JSF components built with the help of Ajax4jsf.
+ </para>
+ <para>To find out more on <property>skinnability</property>
possibilities, follow these
+ steps:</para>
+ <itemizedlist>
+ <listitem>
+ Create a custom render kit and register it in the faces-config.xml
+ like this:
+ <programlisting role="XML"><![CDATA[<render-kit>
+ <render-kit-id>NEW_SKIN</render-kit-id>
+ <render-kit-class>
+ org.ajax4jsf.framework.renderer.ChameleonRenderKitImpl
+ </render-kit-class>
+</render-kit>]]></programlisting>
+ </listitem>
+ <listitem>
+ Then you need to create and register custom renderers for the
+ component based on the look-and-feel predefined variables:
+ <programlisting role="XML"><![CDATA[<renderer>
+ <component-family>javax.faces.Command</component-family>
+ <renderer-type>javax.faces.Link</renderer-type>
+ <renderer-class>
+ newskin.HtmlCommandLinkRenderer
+ </renderer-class>
+</renderer>]]></programlisting>
+ </listitem>
+ <listitem>
+ Finally, you need to place a properties file with skin parameters
+ into the class path root. There are two requirements for the properties
+ file:
+ <itemizedlist>
+ <listitem>
+ The file must be named <emphasis
role="bold"><property><skinName></property></emphasis>.skin.properties,
in this case, it would be called
+ <filename>newskin.skin.properties</filename>.
+ </listitem>
+ <listitem>
+ The first line in this file should be render.kit=
+ <emphasis
role="bold"><property><render-kit-id></property>,</emphasis>
in this case, it would be called
+ render.kit=NEW_SKIN.
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </itemizedlist>
+ <para>Extra information on custom renderers creation can be found
+ at:</para>
+ <simplelist>
+ <member>
+ <ulink
url="http://java.sun.com/javaee/javaserverfaces/reference/docs/index...
+ </member>
+ </simplelist></section>
</chapter>
\ No newline at end of file
Modified: trunk/docs/userguide/en/src/main/docbook/modules/RFCsetwebappl.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/modules/RFCsetwebappl.xml 2007-08-06 10:39:16
UTC (rev 2069)
+++ trunk/docs/userguide/en/src/main/docbook/modules/RFCsetwebappl.xml 2007-08-06 11:03:43
UTC (rev 2070)
@@ -1,110 +1,460 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<chapter id="SettingAWebApplication"
xreflabel="SettingAWebApplication">
-<?dbhtml filename="SettingAWebApplication.html" ?>
-
- <chapterinfo>
+<?xml version='1.0' encoding='UTF-8'?>
+<chapter id="SettingsForDifferentEnvironments"
xreflabel="SettingsForDifferentEnvironments">
+ <?dbhtml filename="SettingsForDifferentEnvironments.html"?>
+<chapterinfo>
<keywordset>
- <keyword>Web Application</keyword>
+ <keyword>MyFaces</keyword>
- <keyword>Rich Faces</keyword>
+ <keyword>JSF</keyword>
<keyword>Ajax4jsf</keyword>
+ <keyword>AjaxViewHandler</keyword>
</keywordset>
</chapterinfo>
- <title>Setting Up a Web Application to Use Rich Faces</title>
+ <title>Settings for different environments</title>
+ <para>Ajax4jsf comes with support for all tags (components) included in the
+ JavaServer Faces specification. To add Ajax4jsf capabilities to an existing
+ JSF project you should just put the Ajax4jsf libraries into the lib folder of
+ the project and add filter mapping. The behavior of the existing project
+ doesn't change just because of Ajax4jsf.</para>
+&wadParams;
+<section id="SunJSFRI">
+<?dbhtml filename="SunJSFRI.html"?>
+ <title>Sun JSF RI</title>
+ <para>Ajax4jsf works with any implementation of
<property>JSF</property> (both JSF 1.1 and
+ JSF 1.2) and with most <property>JSF</property> component libraries
without any additional settings.
+ For more information look at:</para>
+
+<simplelist>
+<member>
+ <ulink
url="http://java.sun.com/javaee/javaserverfaces/">java.sun.c...
+</member>
+</simplelist>
+
+ </section>
+ <section id="ApacheMyFaces">
+ <?dbhtml filename="ApacheMyFaces.html"?>
+ <title>Apache MyFaces</title>
+ <para>Ajax4jsf works with all <property>Apache MyFaces</property>
versions (1.1.1 - 1.1.5)
+ including specific libraries like Tomahawk Sandbox and
+ Trinidad (the previous ADF Faces). However, there are some considerations
+ to take into account for configuring applications to work with
<property>MyFaces</property> and
+ Ajax4jsf.</para>
+ <para>There are some problems with different filters defined in
+ the web.xml file clashing. To avoid these problems, the Ajax4jsf filter
+ must be the first one among other filters in the web.xml configuration
+ file.</para>
+ <para>For more information look at:<ulink
url="http://myfaces.apache.org">http://myfaces.apache.org</ulink></para>
+ <para>
+ There's one more problem while using <property>MyFaces +
Seam</property>. If you use this combination you should use
+ <emphasis role="bold">
+ <property><a4j:page></property>
+ </emphasis> inside<emphasis role="bold">
+ <property><f:view></property>
+ </emphasis>(right after it in your code) wrapping another content
+ inside your pages because of some problems in realization of <emphasis
role="bold">
+ <property><f:view></property>
+ </emphasis> in myFaces.
+ </para>
+ <para>The problem is to be overcome in the nearest future.</para>
+ </section>
+ <section id="FaceletsSupport">
+ <?dbhtml filename="FaceletsSupport.html"?>
+ <title>Facelets Support</title>
+ <para>A high-level support for <property>Facelets</property> is one
of our main support
+ features. When working with Ajax4jsf, there is no difference what release
+ of <property>Facelets</property> is used. </para>
+ <para>You should also take into account that some JSF frameworks such as
<property>Facelets</property> use their own
+ ViewHandler and need to have it first in the chain of ViewHandlers and the
+ Ajax4jsf AjaxViewHandler is not an exception. At first Ajax4jsf installs its
ViewHandler in any case, so in case of two frameworks, for example Ajax4jsf + Facelets, no
changes in settings are required. Although, when more then one framework (except Ajax4jsf)
is used, it's possible to use the VIEW_HANDLERS parameter defining these frameworks
view handlers according to its usage order in it.
+ For example, the
+ declaration:</para>
- <para>Using the Rich Faces library doesn't require a major change of
- approach in how you set up a Web application, but a few steps are necessary,
- mostly for setting up the Ajax4jsf framework. When you just add RichFaces
- capability to an existing project, the behavior of the application doesn't
- change.</para>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="XML"> <context-param>
+ <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
+
<param-value>com.sun.facelets.FaceletViewHandler</param-value>
+ </context-param></programlisting>
+ <para>says that <property>Facelets</property> will officially be
the first, however AjaxViewHandler
+ will be a little ahead temporarily to do some small, but very
+ important job. </para>
+ <note>
+ <title>Note:</title>
+ <para>In this case you don't have to define
<property>FaceletViewHandler</property> in the
+ WEB-INF/faces-config.xml.</para>
+ </note>
+ </section>
+ <section id="JBossSeamSupport">
+ <?dbhtml filename="JBossSeamSupport.html"?>
+ <title>JBoss Seam Support</title>
+ <para>Ajax4jsf 1.1 now works out-of-the-box with <property>JBoss Seam
</property>and Facelets running inside JBoss AS 4.0.4 and higher.
+ There is no more shared JAR files needed. You just have to package the Ajax4jsf
library with your application.
+ </para>
+ <para>
+ Your web.xml still must be like this:
+ </para>
+ <programlisting role="XML"><![CDATA[web-app
version="2.4"
+
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
- <section id="Installation">
-<?dbhtml filename="Installation.html" ?>
+ <!-- Seam -->
+ <listener>
+ <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
+ </listener>
- <title>Installation</title>
+ <!-- ajax4jsf -->
+ <filter>
+ <display-name>Ajax4jsf Filter</display-name>
+ <filter-name>ajax4jsf</filter-name>
+ <filter-class>org.ajax4jsf.Filter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>ajax4jsf</filter-name>
+ <url-pattern>*.seam</url-pattern>
+ </filter-mapping>
- <itemizedlist>
- <listitem>
- Copy the
+ <!-- Propagate conversations across redirects -->
+ <filter>
+ <filter-name>Seam Redirect Filter</filter-name>
+
<filter-class>org.jboss.seam.servlet.SeamRedirectFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>Seam Redirect Filter</filter-name>
+ <url-pattern>*.seam</url-pattern>
+ </filter-mapping>
+
+ <filter>
+ <filter-name>Seam Exception Filter</filter-name>
+ <filter-class>org.jboss.seam.servlet.SeamExceptionFilter</filter-class>
+ </filter>
- <emphasis
-
><property>"richfaces-3.0.x.jar"</property></emphasis>
+ <filter-mapping>
+ <filter-name>Seam Exception Filter</filter-name>
+ <url-pattern>*.jsf</url-pattern>
+ </filter-mapping>
+
+ <!-- JSF -->
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>client</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
+ <param-value>com.sun.facelets.FaceletViewHandler</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>facelets.REFRESH_PERIOD</param-name>
+ <param-value>2</param-value>
+ </context-param>
+ <context-param>
+ <param-name>facelets.DEVELOPMENT</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <param-name>com.sun.faces.validateXml</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <param-name>com.sun.faces.verifyObjects</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.ajax4jsf.SKIN</param-name>
+ <param-value>DEFAULT</param-value>
+ </context-param>
+
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
- file into the
+ <!-- Faces Servlet Mapping -->
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.seam</url-pattern>
+ </servlet-mapping>
- <emphasis >
- <property>"WEB-INF/lib"</property>
- </emphasis>
+ <!-- MyFaces -->
+ <listener>
+
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
+ </listener>
+</web-app>]]> </programlisting>
+ <para>Only one issue still persists while using
<property>Seam</property> with MyFaces. Look at myFaces part of this
section.</para>
+ </section>
+ <section id="Portlet Support">
+ <title>Portlet Support</title>
+ <para><property>Portlets</property> have support since version
Ajax4jsf 1.1.1. Provide your feedback on compatible with Ajax4jsf if you face some
problems.</para>
+ </section>
+ <section id="Sybase EAServer">
+ <title>Sybase EAServer</title>
+ <para>The load-on-startup for the Faces Servlet had to be set to 0 in
web.xml.</para>
- folder of your application.
- </listitem>
- </itemizedlist>
-
- <para>Ajax4jsf is then set up as usual:</para>
-
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="XML"><![CDATA[...
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>0</load-on-startup>
+ </servlet>
+...
+]]></programlisting>
+ <para> This is because, EAServer calls servlet init() before the
ServletContextInitializer. Not an EAServer bug, this is in Servlet 2.3 spec.</para>
+ </section>
+ <!-- <title>Getting Started with Ajax4jsf</title>
+ -->
+ <section id="Environment">
+ <?dbhtml filename="Environment.html" ?>
+ <title>Environment</title>
+ <para>
+ To use Ajax4jsf framework you need JDK 1.4 or higher, any JSF implementation
+ and your favorite Servlet Container. To read more on the
<property>Environments</property>, see further chapters.</para>
+ <para>
+ Ajax4jsf is designed in an easy-to-use way, so that you should do only a few simple
steps to get AJAX functionality in your JSF application.
+ </para>
+ </section>
+ <section id="DownloadingAjax4jsf">
+ <?dbhtml filename="DownloadingAjax4jsf.html" ?>
+ <title>Downloading Ajax4jsf</title>
+ <para>The latest release of <property>Ajax4jsf</property> is
available for download at:<simplelist><member><ulink
url="http://labs.jboss.com/portal/jbossajax4jsf/downloads">h...
+ in the <property>Ajax4jsf</property> project area under
JBoss.</para>
+ </section>
+ <section id="Installation">
+ <?dbhtml filename="Installation.html" ?>
+ <title>Installation</title>
<itemizedlist>
<listitem>
- Copy the
-
- <emphasis
><property>"ajax4jsf.jar"</property></emphasis>
-
- and
-
- <emphasis
-
><property>"oscache2.3.2.jar"</property></emphasis>
-
- files into the
-
- <emphasis >
- <property>"WEB-INF/lib"</property>
- </emphasis>
-
- folder of your application.
+
+ Unzip <emphasis >
+ <property>"ajax4jsf.zip"</property>
+ </emphasis> file to the chosen folder.
+
</listitem>
-
<listitem>
- Insert this filter setting into the web.xml file for the application:
+
+ Copy <emphasis
><property>"ajax4jsf.jar"</property></emphasis> and
<emphasis
><property>"oscache-2.3.2.jar"</property></emphasis>
files into the <emphasis >
+ <property>"WEB-INF/lib"</property>
+ </emphasis> folder of your application.
+
</listitem>
- </itemizedlist>
-
- <programlisting role="XML"><context-param>
- <param-name>org.ajax4jsf.SKIN</param-name>
- <param-value>blueSky</param-value>
- </context-param>
- <filter>
- <display-name>Ajax4jsf Filter</display-name>
- <filter-name>ajax4jsf</filter-name>
- <filter-class>org.ajax4jsf.Filter</filter-class>
- </filter>
- <filter-mapping>
- <filter-name>ajax4jsf</filter-name>
- <servlet-name>Faces Servlet</servlet-name>
- <dispatcher>REQUEST</dispatcher>
- <dispatcher>FORWARD</dispatcher>
- <dispatcher>INCLUDE</dispatcher>
- </filter-mapping></programlisting>
-
- <para>Then, for each page where you need to use a RichFaces component, add
- the appropriate line to the top of the page.</para>
-
- <itemizedlist>
+ <note>
+ <title>Note:</title>
+ <para>Starting from Ajax4jsf 1.1.1, the oscache library is not
required to be in the classpath anymore.
+ </para>
+ </note>
<listitem>
- For JSP pages:
+ Add the following content into the <emphasis >
+ <property>"WEB-INF/web.xml"</property>
+ </emphasis> file of your application:
+
+ <programlisting role="XML"><![CDATA[<filter>
+ <display-name>Ajax4jsf Filter</display-name>
+ <filter-name>ajax4jsf</filter-name>
+ <filter-class>org.ajax4jsf.Filter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>ajax4jsf</filter-name>
+ <servlet-name>Faces Servlet</servlet-name>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>FORWARD</dispatcher>
+ <dispatcher>INCLUDE</dispatcher>
+ </filter-mapping>]]></programlisting>
+ <note>
+ <title>Note:</title>
+ <para>You can copy and paste the above text from the <emphasis >
+ <property>"README.txt"</property>
+ </emphasis> file.</para>
+ </note>
</listitem>
- </itemizedlist>
-
- <programlisting role="XML"><%@ taglib
uri="http://richfaces.ajax4jsf.org/rich"
prefix="rich"%></programlisting>
-
- <itemizedlist>
<listitem>
- For XHTML pages:
+
+ <para>Add the following line for each JSP page of your application where
you are going to bring in AJAX functionality.</para>
+ <programlisting role="XML"> <![CDATA[<%@ taglib
uri="https://ajax4jsf.dev.java.net/ajax"
prefix="a4j"%>]]></programlisting>
+ <para>For XHTML pages:</para>
+ <programlisting
role="XML"><xmlns:a4j="https://ajax4jsf.dev.java...
</listitem>
</itemizedlist>
-
- <programlisting
role="XML"><xmlns:rich="http://richfaces.ajax4js...
</section>
-
- &wadParams;
-</chapter>
\ No newline at end of file
+ <section id="SimpleAJAXEchoProject">
+ <?dbhtml filename="SimpleAJAXEchoProject.html" ?>
+ <title>Simple AJAX Echo Project </title>
+ <para>
+ In our JSF project you need only one JSP page that has a form with a couple of
child tags:
+ <emphasis role="bold">
+ <property><h:inputText></property>
+ </emphasis> and <emphasis role="bold">
+ <property><h:outputText></property>
+ </emphasis>.
+ </para>
+ <para>This simple application let you input some text into the <emphasis
role="bold">
+ <property><h:inputText></property>
+ </emphasis>,
+ send data to the server, and see the server response as a value of <emphasis
role="bold">
+ <property><h:outputText></property>
+ </emphasis>.
+ </para>
+ <section id="JSPPage">
+ <?dbhtml filename="JSPPage.html"?>
+ <title>JSP Page</title>
+ <para>Here is the necessary page (echo.jsp):</para>
+ <programlisting role="JSP"> <![CDATA[<%@ taglib
uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
+ <%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h"%>
+ <%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f"%>
+ <html>
+ <head>
+ <title>repeater </title>
+ </head>
+ <body>
+ <f:view>
+ <h:form>
+ <h:inputText size="50" value="#{bean.text}" >
+ <a4j:support event="onkeyup" reRender="rep"/>
+ </h:inputText>
+ <h:outputText value="#{bean.text}" id="rep"/>
+ </h:form>
+ </f:view>
+ </body>
+ </html>]]></programlisting>
+ <para>The only line that distinguishes this page from a
"regular" JSF one is</para>
+ <programlisting role="XML"><![CDATA[<a4j:support
event="onkeyup" reRender="rep"/>]]></programlisting>
+ <para>The line adds an AJAX support to the parent <emphasis
role="bold">
+ <property><h:inputText></property>
+ </emphasis> tag. This support is
+ bound to "onkeyup" JavaScript event, so that each time when
this event is fired on the
+ parent tag, our application sends an AJAX request to the server. It means that
the
+ text field pointed to our managed bean property contains up-to-date value of our
input.
+ </para>
+ <para>
+ The value of <emphasis
><property>"reRender"</property></emphasis>
attribute of the <emphasis role="bold">
+ <property><a4j:support></property>
+ </emphasis> tag defines which part(s) of our
+ page is (are) to be updated. In this case, the only part of the page to
+ update is the <emphasis role="bold">
+ <property><h:outputText></property>
+ </emphasis> tag because its ID value matches to the value of <emphasis
><property>"reRender"</property></emphasis>
+ attribute. As you see, it's not difficult to update multiple elements
on the page, only list their IDs
+ as the value of <emphasis
><property>"reRender"</property></emphasis>.
+ </para>
+ </section>
+ <section id="DataBean">
+ <?dbhtml filename="DataBean.html"?>
+ <title>Data Bean</title>
+ <para>In order to build this application, you should create a managed
bean:</para>
+ <programlisting role="JAVA">package demo;
+
+public class Bean {
+ private String text;
+ public Bean() {
+ }
+ public String getText() {
+ return text;
+ }
+ public void setText(String text) {
+ this.text = text;
+ }
+}</programlisting>
+ </section>
+ <section id="faces-config.xml">
+ <?dbhtml filename="faces-config.xml.html"?>
+ <title>faces-config.xml</title>
+ <para>Next, it's necessary to register your bean inside of the
faces-config.xml file:</para>
+ <programlisting role="XML"> <![CDATA[<?xml
version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer
Faces Config 1.1//EN"
+ "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
+ <faces-config>
+ <managed-bean>
+ <managed-bean-name>bean</managed-bean-name>
+ <managed-bean-class>demo.Bean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ <managed-property>
+ <property-name>text</property-name>
+ <value/>
+ </managed-property>
+ </managed-bean>
+ </faces-config>]]></programlisting>
+ <para> <note>
+ <title>Note:</title>
+ <para>Nothing that relates directly to Ajax4jsf is required
+ in the configuration file.</para>
+ </note></para>
+ </section>
+ <section id="Web.xml">
+ <?dbhtml filename="Web.xml.html"?>
+ <title>Web.xml</title>
+ <para>It is also necessary to add jar files (see <ulink
url="GettingStartedWithAjax4jsf.html#Installation">installation
chapter</ulink>) and modify the "web.xml" file:
+ </para>
+ <programlisting role="XML"> <![CDATA[<?xml
version="1.0"?>
+ <web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+ <display-name>a4jEchoText</display-name>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+ <filter>
+ <display-name>Ajax4jsf Filter</display-name>
+ <filter-name>ajax4jsf</filter-name>
+ <filter-class>org.ajax4jsf.Filter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>ajax4jsf</filter-name>
+ <servlet-name>Faces Servlet</servlet-name>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>FORWARD</dispatcher>
+ <dispatcher>INCLUDE</dispatcher>
+ </filter-map>
+ <listener>
+ <listener-class>
+ com.sun.faces.config.ConfigureListener
+ </listener-class>
+ </listener>
+
+ <!-- Faces Servlet -->
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>
+ javax.faces.webapp.FacesServlet
+ </servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <!-- Faces Servlet Mapping -->
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ </login-config>
+ </web-app>]]></programlisting>
+ <para>Now your application should work.</para>
+ </section>
+ <section id="Deployment">
+ <?dbhtml filename="Deployment.html"?>
+ <title>Deployment</title>
+ <para>Finally, you should be able to place this application on your Web
+ server.To start your project, point
+ your browser at
+<ulink
url="http://localhost:8080/a4jEchoText/echo.jsf">http://localhost:8080/a4jEchoText/echo.jsf</ulink>
+</para>
+ </section>
+ </section>
+ <section id="Relevant_src">
+ <title>Other Relevant Resources</title>
+ <para><ulink
url="http://jsf.javabeat.net/articles/2007/06/introduction-to-ajax4j...
to Ajax4Jsf - Sample Application</ulink> by Shunmuga Raja</para>
+ </section>
+</chapter>