Author: SeanRogers
Date: 2009-12-22 02:12:06 -0500 (Tue, 22 Dec 2009)
New Revision: 16187
Added:
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-richajaxValidator-Using_richajaxValidator_with_Hibernate_Validator-0.xml_sample
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-richajaxValidator-Using_richajaxValidator_with_Hibernate_Validator-1.js
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-richajaxValidator-richajaxValidator_example.xml_sample
Removed:
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml
Modified:
root/docs/trunk/Component_Reference/en-US/Book_Info.xml
root/docs/trunk/Component_Reference/en-US/Component_Reference.xml
root/docs/trunk/Component_Reference/en-US/Preface.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Containers.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Validation.xml
Log:
Worked on Validators and added ref data to Containers
Modified: root/docs/trunk/Component_Reference/en-US/Book_Info.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/Book_Info.xml 2009-12-22 05:19:34 UTC (rev
16186)
+++ root/docs/trunk/Component_Reference/en-US/Book_Info.xml 2009-12-22 07:12:06 UTC (rev
16187)
@@ -29,7 +29,7 @@
<year>&YEAR;</year>
<holder>&HOLDER;</holder>
</copyright>
- <!-- FOR PUBLICAN --><xi:include
href="Common_Content/Legal_Notice.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"><!-- FOR
JDOCBOOK: --><xi:fallback
xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include
href="fallback_content/Legal_Notice.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <!-- FOR PUBLICAN --><xi:include
href="Common_Content/Legal_Notice.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"><!-- FOR
JDOCBOOK: --><xi:fallback
xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include
href="fallback_content/Legal_Notice.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
</xi:fallback>
</xi:include>
<xi:include href="Author_Group.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
Modified: root/docs/trunk/Component_Reference/en-US/Component_Reference.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/Component_Reference.xml 2009-12-22 05:19:34
UTC (rev 16186)
+++ root/docs/trunk/Component_Reference/en-US/Component_Reference.xml 2009-12-22 07:12:06
UTC (rev 16187)
@@ -3,9 +3,9 @@
]>
<book status="draft">
<xi:include href="Book_Info.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
- <!--
+ <!--
<xi:include href="Preface.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- --><xi:include href="chap-Component_Reference-Introduction.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
+ --><xi:include
href="chap-Component_Reference-Introduction.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="chap-Component_Reference-Common_Ajax_attributes.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="chap-Component_Reference-Common_features.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
<part id="part-Component_Reference-a4j_tag_library">
Modified: root/docs/trunk/Component_Reference/en-US/Preface.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/Preface.xml 2009-12-22 05:19:34 UTC (rev
16186)
+++ root/docs/trunk/Component_Reference/en-US/Preface.xml 2009-12-22 07:12:06 UTC (rev
16187)
@@ -3,10 +3,10 @@
]>
<preface id="pref-Component_Reference-Preface">
<title>Preface</title>
- <!-- FOR JDOCBOOK --><xi:include
href="Common_Content/Conventions.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"><!-- FOR
PUBLICAN --><xi:fallback
xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include
href="fallback_content/Conventions.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <!-- FOR JDOCBOOK --><xi:include
href="Common_Content/Conventions.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"><!-- FOR
PUBLICAN --><xi:fallback
xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include
href="fallback_content/Conventions.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
</xi:fallback>
</xi:include>
- <!-- PUBLICAN'S ORIGINAL XINCLUDES
--><xi:include href="Feedback.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"><xi:fallback
xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include
href="Common_Content/Feedback.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"><!-- FOR
JDOCBOOK --><xi:fallback
xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include
href="fallback_content/Feedback.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <!-- PUBLICAN'S ORIGINAL XINCLUDES
--><xi:include href="Feedback.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"><xi:fallback
xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include
href="Common_Content/Feedback.xml"
xmlns:xi="http://www.w3.org/2001/XInclude"><!-- FOR
JDOCBOOK --><xi:fallback
xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include
href="fallback_content/Feedback.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
</xi:fallback>
</xi:include>
</xi:fallback>
Modified:
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Containers.xml
===================================================================
---
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Containers.xml 2009-12-22
05:19:34 UTC (rev 16186)
+++
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Containers.xml 2009-12-22
07:12:06 UTC (rev 16187)
@@ -8,6 +8,28 @@
</para>
<section id="sect-Component_Reference-Containers-a4jform">
<title><a4j:form></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.ajax4jsf.Form</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family: <classname>javax.faces.Form</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class:
<classname>org.ajax4jsf.component.html.AjaxForm</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ renderer-type: <classname>org.ajax4jsf.FormRenderer</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
<para>
The <sgmltag><a4j:form></sgmltag> builds on the
functionality of the JavaServer Faces (<acronym>JSF</acronym>) component
<sgmltag><h:form></sgmltag>, adding Ajax capabilities to the
form.
</para>
@@ -66,26 +88,51 @@
<para>
The page uses <sgmltag><a4j:include></sgmltag> to include
the first step of the wizard:
</para>
+
<programlisting language="XML" role="XML">
-<xi:include parse="text"
href="extras/exam-Component_Reference-a4jinclude-A_wizard_using_a4jinclude-0.xml_sample"
xmlns:xi="http://www.w3.org/2001/XInclude" />
+<xi:include
href="extras/exam-Component_Reference-a4jinclude-A_wizard_using_a4jinclude-0.xml_sample"
parse="text"
xmlns:xi="http://www.w3.org/2001/XInclude" />
</programlisting>
<para>
The first step is fully contained in a separate file,
<filename>wstep1.xhtml</filename>. Subsequent steps are set up similarly with
additional <guibutton>Previous</guibutton> buttons.
</para>
+
<programlisting language="XML" role="XML">
-<xi:include parse="text"
href="extras/exam-Component_Reference-a4jinclude-A_wizard_using_a4jinclude-1.xml_sample"
xmlns:xi="http://www.w3.org/2001/XInclude" />
+<xi:include
href="extras/exam-Component_Reference-a4jinclude-A_wizard_using_a4jinclude-1.xml_sample"
parse="text"
xmlns:xi="http://www.w3.org/2001/XInclude" />
</programlisting>
<para>
The navigation is defined in the <filename>faces-config.xml</filename>
configuration file:
</para>
+
<programlisting language="XML" role="XML">
-<xi:include parse="text"
href="extras/exam-Component_Reference-a4jinclude-A_wizard_using_a4jinclude-2.xml_sample"
xmlns:xi="http://www.w3.org/2001/XInclude" />
+<xi:include
href="extras/exam-Component_Reference-a4jinclude-A_wizard_using_a4jinclude-2.xml_sample"
parse="text"
xmlns:xi="http://www.w3.org/2001/XInclude" />
</programlisting>
</example>
</section>
<section id="sect-Component_Reference-Containers-a4joutputPanel">
<title><a4j:outputPanel></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.ajax4jsf.OutputPanel</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family: <classname>javax.faces.Panel</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class:
<classname>org.ajax4jsf.component.html.HtmlAjaxOutputPanel</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ renderer-type:
<classname>org.ajax4jsf.components.AjaxOutputPanelRenderer</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
<para>
The <sgmltag><a4j:outputPanel></sgmltag> component is used
to group together components in to update them as a whole, rather than having to specify
the components individually.
</para>
@@ -116,6 +163,28 @@
<section id="sect-Component_Reference-Containers-a4jregion">
<title><a4j:region></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.ajax4jsf.AjaxRegion</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family: <classname>org.ajax4jsf.AjaxRegion</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class:
<classname>org.ajax4jsf.component.html.HtmlAjaxRegion</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ renderer-type:
<classname>org.ajax4jsf.components.AjaxRegionRenderer</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
<para>
The <sgmltag><a4j:region></sgmltag> component specifies a
part of the document object model (<acronym>DOM</acronym>) tree to be
processed on the server. The processing includes data handling during decoding,
conversion, validation, and model updating. When not using
<sgmltag><a4j:region></sgmltag>, the entire view functions as a
region.
</para>
Deleted: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml
===================================================================
---
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml 2009-12-22
05:19:34 UTC (rev 16186)
+++
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml 2009-12-22
07:12:06 UTC (rev 16187)
@@ -1,318 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-]>
-<chapter id="chap-Component_Reference-Resources">
- <title>Resources</title>
- <para>
- This chapter covers those components used to handle and manage resources and beans.
- </para>
- <section id="sect-Component_Reference-Resources-a4jloadBundle">
- <title><a4j:loadBundle></title>
- <itemizedlist>
- <listitem>
- <para>
- component-type: <classname>org.ajax4jsf.Bundle</classname>
- </para>
- </listitem>
- <listitem>
- <para>
- component-family: <classname>org.ajax4jsf.Bundle</classname>
- </para>
- </listitem>
- <listitem>
- <para>
- component-class:
<classname>org.ajax4jsf.component.html.AjaxLoadBundle</classname>
- </para>
- </listitem>
- </itemizedlist>
- <para>
- The <sgmltag><a4j:loadBundle></sgmltag> component is used to
load resource bundles to aid in localization of an application. The bundles are localized
to the locale of the current view, and properties are stored as a map in the current
request attributes.
- </para>
- <para>
- The <sgmltag><a4j:loadBundle></sgmltag> component allows
bundles to be accessed by Ajax requests working in their own address scopes. This solves
the problem of using the <acronym>JSF</acronym>
<sgmltag><h:loadBundle></sgmltag> component with Ajax, where
bundle information loaded with the page was unavailable for later Ajax requests.
- </para>
- <para>
- Resource bundles are registered in the Faces configuration file,
<filename>faces-config.xml</filename>.
- </para>
- <example
id="exam-Component_Reference-a4jloadBundle-a4jloadBundle_example">
- <title><sgmltag><a4j:loadBundle></sgmltag>
example</title>
- <para>
- This example shows a simple application capable of switching between different
localized languages.
- </para>
- <procedure>
- <step
id="step-Component_Reference-a4jloadBundle_example-Create_resource_bundles">
- <title>Create resource bundles</title>
- <para>
- String resource bundles are contained in files with a <filename
class="extension">.properties</filename> extension. The files consist
of a list of entries, each with a unique name and a corresponding value. A seperate file
is required for each language. Append the filename with the locale identifier
(<literal>en</literal> for English, for example).
- </para>
- </step>
- <step
id="step-Component_Reference-a4jloadBundle_example-Register_bundles_in_Faces_configuration_file">
- <title>Register bundles in Faces configuration file</title>
- <para>
- The resource bundles need to be registered in the Faces configuration file,
<filename>faces-config.xml</filename>. The filename is defined with the
<sgmltag><message-bundle></sgmltag> tag, without the locale code
and without the extension. The supported locale codes are listed with
<sgmltag><supported-locale></sgmltag> tags.
- </para>
-
-<programlisting language="XML" role="XML">
-<xi:include
href="extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-0.xml_sample"
parse="text"
xmlns:xi="http://www.w3.org/2001/XInclude" />
-</programlisting>
- </step>
- <step
id="step-Component_Reference-a4jloadBundle_example-Create_method_to_set_locale">
- <title>Create method to set locale</title>
- <para>
- The <acronym>JSF</acronym>
<methodname>javax.faces.component.UIViewRoot.setLocale()</methodname> method
can be used to update the locale through a Java class:
- </para>
-
-<programlisting language="Java" role="JAVA">
-<xi:include
href="extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-1.js"
parse="text"
xmlns:xi="http://www.w3.org/2001/XInclude" />
-</programlisting>
- </step>
- <step
id="step-Component_Reference-a4jloadBundle_example-Add_a4jloadBundle_to_the_JSP_page">
- <title>Add <sgmltag><a4j:loadBundle></sgmltag> to
the <acronym>JSP</acronym> page</title>
- <para>
- The <sgmltag><a4j:loadBundle></sgmltag> component is
added to the application, and links to change the locale will update the displayed text.
- </para>
-
-<programlisting language="XML" role="XML">
-<xi:include
href="extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-2.xml_sample"
parse="text"
xmlns:xi="http://www.w3.org/2001/XInclude" />
-</programlisting>
- </step>
- </procedure>
-
- <para>
- Clicking on the different links will render the localized string as appropriate.
- </para>
- </example>
- </section>
-
- <section id="sect-Component_Reference-Resources-a4jloadScript">
- <title><a4j:loadScript></title>
- <itemizedlist>
- <listitem>
- <para>
- component-type: <classname>org.ajax4jsf.LoadScript</classname>
- </para>
- </listitem>
- <listitem>
- <para>
- component-family: <classname>org.ajax4jsf.LoadScript</classname>
- </para>
- </listitem>
- <listitem>
- <para>
- component-class:
<classname>org.ajax4jsf.component.html.HtmlLoadScript</classname>
- </para>
- </listitem>
- <listitem>
- <para>
- renderer-type: <classname>org.ajax4jsf.LoadScriptRenderer</classname>
- </para>
- </listitem>
- </itemizedlist>
- <para>
- The <sgmltag><a4j:loadScript></sgmltag> component allows
scripts to be loaded from external sources such as <filename>jar</filename>
files.
- </para>
- <para>
- The required <varname>src</varname> attribute defines the path to the
script. A leading slash (<literal>/</literal>) represents the root of the web
context. The <code>resource://</code> prefix can be used to access a file in
the RichFaces resource framework. The path is passed to the
<methodname>getResourceURL()</methodname> method of the application's
<classname>ViewHandler</classname>, with the result then being passed through
the <methodname>encodeResourceURL()</methodname> method of
<classname>ExternalContext</classname>.
- </para>
- <example
id="exam-Component_Reference-a4jloadScript-a4jloadScript_example">
- <title><sgmltag><a4j:loadScript></sgmltag>
example</title>
-
-<programlisting language="XML" role="XML">
-<a4j:loadScript src="resource:///org/mycompany/assets/script/focus.js"
/>
-</programlisting>
- </example>
- </section>
-
- <section id="sect-Component_Reference-Resources-a4jloadStyle">
- <title><a4j:loadStyle></title>
- <itemizedlist>
- <listitem>
- <para>
- component-type: <classname>org.ajax4jsf.LoadStyle</classname>
- </para>
- </listitem>
- <listitem>
- <para>
- component-family: <classname>org.ajax4jsf.LoadStyle</classname>
- </para>
- </listitem>
- <listitem>
- <para>
- component-class:
<classname>org.ajax4jsf.component.html.HtmlLoadStyle</classname>
- </para>
- </listitem>
- <listitem>
- <para>
- renderer-type: <classname>org.ajax4jsf.LoadStyleRenderer</classname>
- </para>
- </listitem>
- </itemizedlist>
- <para>
- The <sgmltag><a4j:loadStyle></sgmltag> component allows a
style sheet to be loaded from an external source, such as a
<filename>jar</filename> file. The style sheet links are inserted into the
head element.
- </para>
- <para>
- The required <varname>src</varname> attribute defines the path to the
script. A leading slash (<literal>/</literal>) represents the root of the web
context. The <code>resource://</code> prefix can be used to access a file in
the RichFaces resource framework. The path is passed to the
<methodname>getResourceURL()</methodname> method of the application's
<classname>ViewHandler</classname>, with the result then being passed through
the <methodname>encodeResourceURL()</methodname> method of
<classname>ExternalContext</classname>.
- </para>
- <example
id="exam-Component_Reference-a4jloadStyle-a4jloadStyle_example">
- <title><sgmltag><a4j:loadStyle></sgmltag>
example</title>
-
-<programlisting language="XML" role="XML">
-<a4j:loadStyle src="resource:///org/mycompany/assets/script/focus.js"
/>
-</programlisting>
- </example>
- </section>
-
- <section id="sect-Component_Reference-Resources-a4jkeepAlive">
- <title><a4j:keepAlive></title>
- <itemizedlist>
- <listitem>
- <para>
- component-type:
<classname>org.ajax4jsf.components.KeepAlive</classname>
- </para>
- </listitem>
- <listitem>
- <para>
- component-family:
<classname>org.ajax4jsf.components.AjaxKeepAlive</classname>
- </para>
- </listitem>
- <listitem>
- <para>
- component-class:
<classname>org.ajax4jsf.components.AjaxKeepAlive</classname>
- </para>
- </listitem>
- </itemizedlist>
- <para>
- The <sgmltag><a4j:keepAlive></sgmltag> component allows the
state of a managed bean to be retained between Ajax requests.
- </para>
- <para>
- Managed beans can be declared with the <literal>request</literal> scope in
the <filename>faces-config.xml</filename> configuration file, using the
<sgmltag><managed-bean-scope></sgmltag> tag. Any references to
the bean instance after the request has ended will cause the server to throw an illegal
argument exception. The <sgmltag><a4j:keepAlive></sgmltag>
component avoids this be maintaining the state of the whole bean object for subsequent
requests.
- </para>
- <para>
- The <varname>beanName</varname> attribute uses JSF Expression Language
(<acronym>EL</acronym>) to define the request scope bean name to keep alive.
The expression must resolve to a managed bean instance. The
<varname>ajaxOnly</varname> attribute determines whether or not the value of
the bean should be available during non-Ajaxx requests; if
<code>ajaxOnly="true"</code>, the request-scope bean keeps its value
during Ajax requests, but any non-Ajax requests will re-create the bean as a regular
request-scope bean.
- </para>
- <example
id="exam-Component_Reference-a4jkeepAlive-a4jkeepAlive_example">
- <title><sgmltag><a4j:keepAlive></sgmltag>
example</title>
-
-<programlisting language="XML" role="XML">
-<a4j:keepAlive beanName="#{myClass.testBean}" />
-</programlisting>
- </example>
- </section>
-
- <section id="sect-Component_Reference-Resources-a4jmediaOutput">
- <title><a4j:mediaOutput></title>
- <itemizedlist>
- <listitem>
- <para>
- component-type: <classname>org.ajax4jsf.Push</classname>
- </para>
- </listitem>
- <listitem>
- <para>
- component-family:
<classname>org.ajax4jsf.components.AjaxPush</classname>
- </para>
- </listitem>
- <listitem>
- <para>
- component-class:
<classname>org.ajax4jsf.component.html.AjaxPush</classname>
- </para>
- </listitem>
- <listitem>
- <para>
- renderer-type:
<classname>org.ajax4jsf.components.AjaxPushRenderer</classname>
- </para>
- </listitem>
- </itemizedlist>
- <para>
- The <sgmltag><a4j:mediaOutput></sgmltag> component is used
for generating images, video, sounds, and other resources defined on the fly.
- </para>
- <para>
- The <varname>createContent</varname> attribute points to the method used
for generating the displayed content. If necessary, the
<varname>value</varname> attribute can be used to pass input data to the
content generation method specified with <varname>createContent</varname>. The
<varname>cacheable</varname> attribute specifies whether the resulting content
will be cached or not.
- </para>
- <para>
- The <varname>mimeType</varname> attribute describes the type of output
content, and corresponds to the type in the header of the
<acronym>HTTP</acronym> request. The <varname>element</varname>
attribute defines <acronym>XHTML</acronym> element used to display the
content:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <literal>img</literal>
- </para>
- </listitem>
- <listitem>
- <para>
- <literal>object</literal>
- </para>
- </listitem>
- <listitem>
- <para>
- <literal>applet</literal>
- </para>
- </listitem>
- <listitem>
- <para>
- <literal>script</literal>
- </para>
- </listitem>
- <listitem>
- <para>
- <literal>link</literal>
- </para>
- </listitem>
- <listitem>
- <para>
- <literal>a</literal>
- </para>
- </listitem>
- </itemizedlist>
- <example
id="exam-Component_Reference-a4jmediaOutput-a4jmediaOutput_example">
- <title><sgmltag><a4j:mediaOutput></sgmltag>
example</title>
- <para>
- This example uses the <sgmltag><a4j:mediaOutput></sgmltag>
component to generate a <acronym>JPEG</acronym> image of verification digits.
The code on the application page is a single element:
- </para>
-
-<programlisting language="XML" role="XML">
-<a4j:mediaOutput element="img" cacheable="false"
session="false" createContent="#{mediaBean.paint}"
value="#{mediaData}" mimeType="image/jpeg" />
-</programlisting>
- <para>
- The <sgmltag><a4j:mediaOutput></sgmltag> component uses the
<methodname>MediaBean.paint</methodname> method to create the image. The
method generates a random number, which is then converted into an output stream and
rendered to a <acronym>JPEG</acronym> image. The
<classname>MediaBean</classname> class is as follows:
- </para>
-
-<programlisting language="Java" role="JAVA">
-<xi:include
href="extras/exam-Component_Reference-a4jmediaOutput-a4jmediaOutput_example-0.js"
parse="text"
xmlns:xi="http://www.w3.org/2001/XInclude" />
-</programlisting>
- <para>
- Another class, <classname>MediaData</classname> is required by the
<varname>value</varname> attribute for keeping data to be used as input for
the content creation method. The <classname>MediaData</classname> class is as
follows:
- </para>
-
-<programlisting language="Java" role="JAVA">
-<xi:include
href="extras/exam-Component_Reference-a4jmediaOutput-a4jmediaOutput_example-1.js"
parse="text"
xmlns:xi="http://www.w3.org/2001/XInclude" />
-</programlisting>
- <para>
- The <sgmltag><a4j:mediaOutput></sgmltag> component uses the
<classname>MediaBean</classname> and
<classname>MediaData</classname> classes to generate a new image on each page
refresh, which appears as shown in <xref
linkend="figu-Component_Reference-a4jmediaOutput-a4jmediaOutput_example_result"
/>
- </para>
- <blockquote>
- <figure
id="figu-Component_Reference-a4jmediaOutput-a4jmediaOutput_example_result">
- <title><sgmltag><a4j:mediaOutput></sgmltag> example
result</title>
- <mediaobject>
- <imageobject>
- <imagedata
fileref="images/figu-Component_Reference-a4jmediaOutput-a4jmediaOutput_example_result.png"
format="PNG" />
- </imageobject>
- <textobject>
- <para>
- The generated image containing a random verification number.
- </para>
- </textobject>
- </mediaobject>
- </figure>
- </blockquote>
- </example>
- <note>
- <title><classname>Serializable</classname> interface</title>
- <para>
- A bean class passed using the <varname>value</varname> attribute of
<sgmltag><a4j:mediaOutput></sgmltag> should implement the
<classname>Serializable</classname> interface so that it will be encoded to
the <acronym>URL</acronym> of the resource.
- </para>
- </note>
- </section>
-
-</chapter>
-
Added: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml
(rev 0)
+++
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml 2009-12-22
07:12:06 UTC (rev 16187)
@@ -0,0 +1,318 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+]>
+<chapter id="chap-Component_Reference-Resources">
+ <title>Resources</title>
+ <para>
+ This chapter covers those components used to handle and manage resources and beans.
+ </para>
+ <section id="sect-Component_Reference-Resources-a4jloadBundle">
+ <title><a4j:loadBundle></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.ajax4jsf.Bundle</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family: <classname>org.ajax4jsf.Bundle</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class:
<classname>org.ajax4jsf.component.html.AjaxLoadBundle</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ The <sgmltag><a4j:loadBundle></sgmltag> component is used to
load resource bundles to aid in localization of an application. The bundles are localized
to the locale of the current view, and properties are stored as a map in the current
request attributes.
+ </para>
+ <para>
+ The <sgmltag><a4j:loadBundle></sgmltag> component allows
bundles to be accessed by Ajax requests working in their own address scopes. This solves
the problem of using the <acronym>JSF</acronym>
<sgmltag><h:loadBundle></sgmltag> component with Ajax, where
bundle information loaded with the page was unavailable for later Ajax requests.
+ </para>
+ <para>
+ Resource bundles are registered in the Faces configuration file,
<filename>faces-config.xml</filename>.
+ </para>
+ <example
id="exam-Component_Reference-a4jloadBundle-a4jloadBundle_example">
+ <title><sgmltag><a4j:loadBundle></sgmltag>
example</title>
+ <para>
+ This example shows a simple application capable of switching between different
localized languages.
+ </para>
+ <procedure>
+ <step
id="step-Component_Reference-a4jloadBundle_example-Create_resource_bundles">
+ <title>Create resource bundles</title>
+ <para>
+ String resource bundles are contained in files with a <filename
class="extension">.properties</filename> extension. The files consist
of a list of entries, each with a unique name and a corresponding value. A seperate file
is required for each language. Append the filename with the locale identifier
(<literal>en</literal> for English, for example).
+ </para>
+ </step>
+ <step
id="step-Component_Reference-a4jloadBundle_example-Register_bundles_in_Faces_configuration_file">
+ <title>Register bundles in Faces configuration file</title>
+ <para>
+ The resource bundles need to be registered in the Faces configuration file,
<filename>faces-config.xml</filename>. The filename is defined with the
<sgmltag><message-bundle></sgmltag> tag, without the locale code
and without the extension. The supported locale codes are listed with
<sgmltag><supported-locale></sgmltag> tags.
+ </para>
+
+<programlisting language="XML" role="XML">
+<xi:include
href="extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-0.xml_sample"
parse="text"
xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
+ </step>
+ <step
id="step-Component_Reference-a4jloadBundle_example-Create_method_to_set_locale">
+ <title>Create method to set locale</title>
+ <para>
+ The <acronym>JSF</acronym>
<methodname>javax.faces.component.UIViewRoot.setLocale()</methodname> method
can be used to update the locale through a Java class:
+ </para>
+
+<programlisting language="Java" role="JAVA">
+<xi:include
href="extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-1.js"
parse="text"
xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
+ </step>
+ <step
id="step-Component_Reference-a4jloadBundle_example-Add_a4jloadBundle_to_the_JSP_page">
+ <title>Add <sgmltag><a4j:loadBundle></sgmltag> to
the <acronym>JSP</acronym> page</title>
+ <para>
+ The <sgmltag><a4j:loadBundle></sgmltag> component is
added to the application, and links to change the locale will update the displayed text.
+ </para>
+
+<programlisting language="XML" role="XML">
+<xi:include
href="extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-2.xml_sample"
parse="text"
xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
+ </step>
+ </procedure>
+
+ <para>
+ Clicking on the different links will render the localized string as appropriate.
+ </para>
+ </example>
+ </section>
+
+ <section id="sect-Component_Reference-Resources-a4jloadScript">
+ <title><a4j:loadScript></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.ajax4jsf.LoadScript</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family: <classname>org.ajax4jsf.LoadScript</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class:
<classname>org.ajax4jsf.component.html.HtmlLoadScript</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ renderer-type: <classname>org.ajax4jsf.LoadScriptRenderer</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ The <sgmltag><a4j:loadScript></sgmltag> component allows
scripts to be loaded from external sources such as <filename>jar</filename>
files.
+ </para>
+ <para>
+ The required <varname>src</varname> attribute defines the path to the
script. A leading slash (<literal>/</literal>) represents the root of the web
context. The <code>resource://</code> prefix can be used to access a file in
the RichFaces resource framework. The path is passed to the
<methodname>getResourceURL()</methodname> method of the application's
<classname>ViewHandler</classname>, with the result then being passed through
the <methodname>encodeResourceURL()</methodname> method of
<classname>ExternalContext</classname>.
+ </para>
+ <example
id="exam-Component_Reference-a4jloadScript-a4jloadScript_example">
+ <title><sgmltag><a4j:loadScript></sgmltag>
example</title>
+
+<programlisting language="XML" role="XML">
+<a4j:loadScript src="resource:///org/mycompany/assets/script/focus.js"
/>
+</programlisting>
+ </example>
+ </section>
+
+ <section id="sect-Component_Reference-Resources-a4jloadStyle">
+ <title><a4j:loadStyle></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.ajax4jsf.LoadStyle</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family: <classname>org.ajax4jsf.LoadStyle</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class:
<classname>org.ajax4jsf.component.html.HtmlLoadStyle</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ renderer-type: <classname>org.ajax4jsf.LoadStyleRenderer</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ The <sgmltag><a4j:loadStyle></sgmltag> component allows a
style sheet to be loaded from an external source, such as a
<filename>jar</filename> file. The style sheet links are inserted into the
head element.
+ </para>
+ <para>
+ The required <varname>src</varname> attribute defines the path to the
script. A leading slash (<literal>/</literal>) represents the root of the web
context. The <code>resource://</code> prefix can be used to access a file in
the RichFaces resource framework. The path is passed to the
<methodname>getResourceURL()</methodname> method of the application's
<classname>ViewHandler</classname>, with the result then being passed through
the <methodname>encodeResourceURL()</methodname> method of
<classname>ExternalContext</classname>.
+ </para>
+ <example
id="exam-Component_Reference-a4jloadStyle-a4jloadStyle_example">
+ <title><sgmltag><a4j:loadStyle></sgmltag>
example</title>
+
+<programlisting language="XML" role="XML">
+<a4j:loadStyle src="resource:///org/mycompany/assets/script/focus.js"
/>
+</programlisting>
+ </example>
+ </section>
+
+ <section id="sect-Component_Reference-Resources-a4jkeepAlive">
+ <title><a4j:keepAlive></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type:
<classname>org.ajax4jsf.components.KeepAlive</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family:
<classname>org.ajax4jsf.components.AjaxKeepAlive</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class:
<classname>org.ajax4jsf.components.AjaxKeepAlive</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ The <sgmltag><a4j:keepAlive></sgmltag> component allows the
state of a managed bean to be retained between Ajax requests.
+ </para>
+ <para>
+ Managed beans can be declared with the <literal>request</literal> scope in
the <filename>faces-config.xml</filename> configuration file, using the
<sgmltag><managed-bean-scope></sgmltag> tag. Any references to
the bean instance after the request has ended will cause the server to throw an illegal
argument exception. The <sgmltag><a4j:keepAlive></sgmltag>
component avoids this be maintaining the state of the whole bean object for subsequent
requests.
+ </para>
+ <para>
+ The <varname>beanName</varname> attribute uses JSF Expression Language
(<acronym>EL</acronym>) to define the request scope bean name to keep alive.
The expression must resolve to a managed bean instance. The
<varname>ajaxOnly</varname> attribute determines whether or not the value of
the bean should be available during non-Ajaxx requests; if
<code>ajaxOnly="true"</code>, the request-scope bean keeps its value
during Ajax requests, but any non-Ajax requests will re-create the bean as a regular
request-scope bean.
+ </para>
+ <example
id="exam-Component_Reference-a4jkeepAlive-a4jkeepAlive_example">
+ <title><sgmltag><a4j:keepAlive></sgmltag>
example</title>
+
+<programlisting language="XML" role="XML">
+<a4j:keepAlive beanName="#{myClass.testBean}" />
+</programlisting>
+ </example>
+ </section>
+
+ <section id="sect-Component_Reference-Resources-a4jmediaOutput">
+ <title><a4j:mediaOutput></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.ajax4jsf.Push</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family:
<classname>org.ajax4jsf.components.AjaxPush</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class:
<classname>org.ajax4jsf.component.html.AjaxPush</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ renderer-type:
<classname>org.ajax4jsf.components.AjaxPushRenderer</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ The <sgmltag><a4j:mediaOutput></sgmltag> component is used
for generating images, video, sounds, and other resources defined on the fly.
+ </para>
+ <para>
+ The <varname>createContent</varname> attribute points to the method used
for generating the displayed content. If necessary, the
<varname>value</varname> attribute can be used to pass input data to the
content generation method specified with <varname>createContent</varname>. The
<varname>cacheable</varname> attribute specifies whether the resulting content
will be cached or not.
+ </para>
+ <para>
+ The <varname>mimeType</varname> attribute describes the type of output
content, and corresponds to the type in the header of the
<acronym>HTTP</acronym> request. The <varname>element</varname>
attribute defines <acronym>XHTML</acronym> element used to display the
content:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <literal>img</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>object</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>applet</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>script</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>link</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>a</literal>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <example
id="exam-Component_Reference-a4jmediaOutput-a4jmediaOutput_example">
+ <title><sgmltag><a4j:mediaOutput></sgmltag>
example</title>
+ <para>
+ This example uses the <sgmltag><a4j:mediaOutput></sgmltag>
component to generate a <acronym>JPEG</acronym> image of verification digits.
The code on the application page is a single element:
+ </para>
+
+<programlisting language="XML" role="XML">
+<a4j:mediaOutput element="img" cacheable="false"
session="false" createContent="#{mediaBean.paint}"
value="#{mediaData}" mimeType="image/jpeg" />
+</programlisting>
+ <para>
+ The <sgmltag><a4j:mediaOutput></sgmltag> component uses the
<methodname>MediaBean.paint</methodname> method to create the image. The
method generates a random number, which is then converted into an output stream and
rendered to a <acronym>JPEG</acronym> image. The
<classname>MediaBean</classname> class is as follows:
+ </para>
+
+<programlisting language="Java" role="JAVA">
+<xi:include
href="extras/exam-Component_Reference-a4jmediaOutput-a4jmediaOutput_example-0.js"
parse="text"
xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
+ <para>
+ Another class, <classname>MediaData</classname> is required by the
<varname>value</varname> attribute for keeping data to be used as input for
the content creation method. The <classname>MediaData</classname> class is as
follows:
+ </para>
+
+<programlisting language="Java" role="JAVA">
+<xi:include
href="extras/exam-Component_Reference-a4jmediaOutput-a4jmediaOutput_example-1.js"
parse="text"
xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
+ <para>
+ The <sgmltag><a4j:mediaOutput></sgmltag> component uses the
<classname>MediaBean</classname> and
<classname>MediaData</classname> classes to generate a new image on each page
refresh, which appears as shown in <xref
linkend="figu-Component_Reference-a4jmediaOutput_example-a4jmediaOutput_example_result"
/>
+ </para>
+ <blockquote>
+ <figure
id="figu-Component_Reference-a4jmediaOutput_example-a4jmediaOutput_example_result">
+ <title><sgmltag><a4j:mediaOutput></sgmltag> example
result</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata
fileref="images/figu-Component_Reference-a4jmediaOutput-a4jmediaOutput_example_result.png"
format="PNG" />
+ </imageobject>
+ <textobject>
+ <para>
+ The generated image containing a random verification number.
+ </para>
+ </textobject>
+ </mediaobject>
+ </figure>
+ </blockquote>
+ </example>
+ <note>
+ <title><classname>Serializable</classname> interface</title>
+ <para>
+ A bean class passed using the <varname>value</varname> attribute of
<sgmltag><a4j:mediaOutput></sgmltag> should implement the
<classname>Serializable</classname> interface so that it will be encoded to
the <acronym>URL</acronym> of the resource.
+ </para>
+ </note>
+ </section>
+
+</chapter>
+
Modified:
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Validation.xml
===================================================================
---
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Validation.xml 2009-12-22
05:19:34 UTC (rev 16186)
+++
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Validation.xml 2009-12-22
07:12:06 UTC (rev 16187)
@@ -4,24 +4,135 @@
<chapter id="chap-Component_Reference-Validation">
<title>Validation</title>
<para>
- Incomplete
+ This chapter covers those components that validate user input. The components enhance
<acronym>JSF</acronym> validation capabilities with Ajax support and the use
of <application>Hibernate</application> validators.
</para>
<section id="sect-Component_Reference-Validation-richajaxValidator">
<title><rich:ajaxValidator></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.richfaces.ajaxValidator</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class:
<classname>org.richfaces.component.html.HtmlajaxValidator</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family: <classname>org.richfaces.ajaxValidator</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ renderer-type:
<classname>org.richfaces.ajaxValidatorRenderer</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ tag-class: <classname>org.richfaces.taglib.ajaxValidatorTag</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
<para>
- Incomplete
+ The <sgmltag><rich:ajaxValidator></sgmltag> component
provides Ajax validation for <acronym>JSF</acronym> inputs. It is added as a
child component to a <acronym>JSF</acronym> tag, and the
<varname>event</varname> attribute specifies when to trigger the validation.
</para>
+ <example
id="exam-Component_Reference-richajaxValidator-richajaxValidator_example">
+ <title><sgmltag><rich:ajaxValidator></sgmltag>
example</title>
+ <para>
+ This example shows the use of
<sgmltag><rich:ajaxValidator></sgmltag> with standard
<acronym>JSF</acronym> validators. The validators check the length of the
entered name, and the range of the entered age.
+ </para>
+
+<programlisting language="XML" role="XML">
+<xi:include
href="extras/exam-Component_Reference-richajaxValidator-richajaxValidator_example.xml_sample"
parse="text"
xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
+ </example>
+ <para>
+ The <sgmltag><rich:ajaxValidator></sgmltag> component can
also work with custom validators made using the <acronym>JSF</acronym>
Validation <acronym>API</acronym> in the
<package>javax.faces.validator</package> package, or with Hibernate Validator.
Refer to the <citetitle>Hibernate Validator documentation</citetitle> for
details on how to use Hibernate Validator.
+ </para>
+ <example
id="exam-Component_Reference-richajaxValidator-Using_richajaxValidator_with_Hibernate_Validator">
+ <title>Using <sgmltag><rich:ajaxValidator></sgmltag>
with Hibernate Validator</title>
+ <para>
+ This example shows the use of
<sgmltag><rich:ajaxValidator></sgmltag> with Hibernate
Validator. It validates the entered name, email, and age.
+ </para>
+
+<programlisting language="XML" role="XML">
+<xi:include
href="extras/exam-Component_Reference-richajaxValidator-Using_richajaxValidator_with_Hibernate_Validator-0.xml_sample"
parse="text"
xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
+ </example>
+ <para>
+ The validation is performed using the
<classname>ValidationBean</classname> class:
+ </para>
+
+<programlisting language="Java" role="JAVA">
+<xi:include
href="extras/exam-Component_Reference-richajaxValidator-Using_richajaxValidator_with_Hibernate_Validator-1.js"
parse="text"
xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
</section>
- <section id="sect-Component_Reference-Validation-richgraphValidator">
- <title><rich:graphValidator></title>
+ <section id="sect-Component_Reference-Validation-richbeanValidator">
+ <title><rich:beanValidator></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.richfaces.beanValidator</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class:
<classname>org.richfaces.component.html.HtmlbeanValidator</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family: <classname>org.richfaces.beanValidator</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ renderer-type:
<classname>org.richfaces.beanValidatorRenderer</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ tag-class: <classname>org.richfaces.taglib.beanValidatorTag</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
<para>
Incomplete
</para>
</section>
- <section id="sect-Component_Reference-Validation-richbeanValidator">
- <title><rich:beanValidator></title>
+ <section id="sect-Component_Reference-Validation-richgraphValidator">
+ <title><rich:graphValidator></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.richfaces.graphValidator</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class:
<classname>org.richfaces.component.html.HtmlgraphValidator</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family: <classname>org.richfaces.graphValidator</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ renderer-type:
<classname>org.richfaces.graphValidatorRenderer</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ tag-class:
<classname>org.richfaces.taglib.graphValidatorTag</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
<para>
Incomplete
</para>
Added:
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-richajaxValidator-Using_richajaxValidator_with_Hibernate_Validator-0.xml_sample
===================================================================
---
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-richajaxValidator-Using_richajaxValidator_with_Hibernate_Validator-0.xml_sample
(rev 0)
+++
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-richajaxValidator-Using_richajaxValidator_with_Hibernate_Validator-0.xml_sample 2009-12-22
07:12:06 UTC (rev 16187)
@@ -0,0 +1,24 @@
+<h:form id="ajaxValidatorForm2">
+ <rich:panel>
+ <f:facet name="header">
+ <h:outputText value="User Info:" />
+ </f:facet>
+ <h:panelGrid columns="3">
+ <h:outputText value="Name:" />
+ <h:inputText value="#{validationBean.name}" id="name"
required="true">
+ <rich:ajaxValidator event="onblur" />
+ </h:inputText>
+ <rich:message for="name" />
+ <h:outputText value="Email:" />
+ <h:inputText value="#{validationBean.email}"
id="email">
+ <rich:ajaxValidator event="onblur" />
+ </h:inputText>
+ <rich:message for="email" />
+ <h:outputText value="Age:" />
+ <h:inputText value="#{validationBean.age}"
id="age">
+ <rich:ajaxValidator event="onblur" />
+ </h:inputText>
+ <rich:message for="age" />
+ </h:panelGrid>
+ </rich:panel>
+</h:form>
Added:
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-richajaxValidator-Using_richajaxValidator_with_Hibernate_Validator-1.js
===================================================================
---
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-richajaxValidator-Using_richajaxValidator_with_Hibernate_Validator-1.js
(rev 0)
+++
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-richajaxValidator-Using_richajaxValidator_with_Hibernate_Validator-1.js 2009-12-22
07:12:06 UTC (rev 16187)
@@ -0,0 +1,65 @@
+package org.richfaces.demo.validation;
+
+import org.hibernate.validator.Email;
+import org.hibernate.validator.Length;
+import org.hibernate.validator.Max;
+import org.hibernate.validator.Min;
+import org.hibernate.validator.NotEmpty;
+import org.hibernate.validator.NotNull;
+import org.hibernate.validator.Pattern;
+
+public class ValidationBean {
+
+ private String progressString="Fill the form in";
+
+ @NotEmpty
+ @Pattern(regex=".*[^\\s].*", message="This string contains only
spaces")
+ @Length(min=3,max=12)
+ private String name;
+ @Email
+ @NotEmpty
+ private String email;
+
+ @NotNull
+ @Min(18)
+ @Max(100)
+ private Integer age;
+
+ public ValidationBean() {
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public Integer getAge() {
+ return age;
+ }
+
+ public void setAge(Integer age) {
+ this.age = age;
+ }
+ public void success() {
+ setProgressString(getProgressString() + "(Stored successfully)");
+ }
+
+ public String getProgressString() {
+ return progressString;
+ }
+
+ public void setProgressString(String progressString) {
+ this.progressString = progressString;
+ }
+}
Added:
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-richajaxValidator-richajaxValidator_example.xml_sample
===================================================================
---
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-richajaxValidator-richajaxValidator_example.xml_sample
(rev 0)
+++
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-richajaxValidator-richajaxValidator_example.xml_sample 2009-12-22
07:12:06 UTC (rev 16187)
@@ -0,0 +1,23 @@
+<rich:panel>
+ <f:facet name="header">
+ <h:outputText value="User Info:" />
+ </f:facet>
+ <h:panelGrid columns="3">
+
+ <h:outputText value="Name:" />
+ <h:inputText value="#{userBean.name}" id="name"
required="true">
+ <f:validateLength minimum="3" maximum="12"/>
+ <rich:ajaxValidator event="onblur"/>
+ </h:inputText>
+ <rich:message for="name" />
+
+ <h:outputText value="Age:" />
+ <h:inputText value="#{userBean.age}" id="age"
required="true">
+ <f:convertNumber integerOnly="true"/>
+ <f:validateLongRange minimum="18" maximum="99"/>
+ <rich:ajaxValidator event="onblur"/>
+ </h:inputText>
+ <rich:message for="age"/>
+
+ </h:panelGrid>
+</rich:panel>