Add doctype declarations to all chapters and xinclude from the main reference file, fix red markers exposed by adding declarations
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
<?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="actions">
|
||||
<title>Executing actions</title>
|
||||
<sect1 id="actions-introduction">
|
||||
@@ -348,7 +350,7 @@ public class BookingAction extends MultiAction {
|
||||
</subfow-state>]]>
|
||||
</programlisting>
|
||||
</sect2>
|
||||
<sect2 id="named actions">
|
||||
<sect2 id="named-actions">
|
||||
<title>Named actions</title>
|
||||
<para>
|
||||
The following example shows how to execute a chain of actions in an action-state.
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?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="defining-flows">
|
||||
<title>Defining Flows</title>
|
||||
<sect1 id="defining-flows-introduction">
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?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="el">
|
||||
<title>Expression Language (EL)</title>
|
||||
<sect1 id="el-introduction">
|
||||
@@ -59,8 +61,10 @@
|
||||
As you can see, explicit delimiters are necessary here to demarcate standard expression blocks within the template.
|
||||
</para>
|
||||
<note>
|
||||
See the Web Flow XML schema for a complete listing of those XML attributes that accept standard expressions and those that accept template expressions.
|
||||
You can also use F2 in Eclipse (or equivalent shortcut in other IDEs) to access available documentation when typing out specific flow definition attributes.
|
||||
<para>
|
||||
See the Web Flow XML schema for a complete listing of those XML attributes that accept standard expressions and those that accept template expressions.
|
||||
You can also use F2 in Eclipse (or equivalent shortcut in other IDEs) to access available documentation when typing out specific flow definition attributes.
|
||||
</para>
|
||||
</note>
|
||||
</sect3>
|
||||
</sect2>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?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">
|
||||
<appendix id="field-mappings">
|
||||
<title>Flow Definition Language 1.0 to 2.0 Mappings</title>
|
||||
<para>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?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="flow-inheritance">
|
||||
<title>Flow Inheritance</title>
|
||||
<sect1 id="flow-inheritance-introduction">
|
||||
@@ -84,9 +86,11 @@
|
||||
They will not be modified as part of the merge process.
|
||||
</para>
|
||||
<note>
|
||||
Paths to external resources in the parent flow should be absolute.
|
||||
Relative paths will break when the two flows are merged unless the parent and child flow are in the same directory.
|
||||
Once merged, all relative paths in the parent flow will become relative to the child flow.
|
||||
<para>
|
||||
Paths to external resources in the parent flow should be absolute.
|
||||
Relative paths will break when the two flows are merged unless the parent and child flow are in the same directory.
|
||||
Once merged, all relative paths in the parent flow will become relative to the child flow.
|
||||
</para>
|
||||
</note>
|
||||
<sect2 id="flow-inheritance-algorithm-mergeable">
|
||||
<title>Mergeable Elements</title>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?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="flow-managed-persistence">
|
||||
<title>Flow Managed Persistence</title>
|
||||
<sect1 id="flow-managed-persistence-introduction">
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?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="flow-security">
|
||||
<title>Securing Flows</title>
|
||||
<sect1 id="flow-security-introduction">
|
||||
|
||||
@@ -1,21 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<preface id="preface">
|
||||
<title>Preface</title>
|
||||
<para>
|
||||
Many web applications require the same sequence of steps to execute in different contexts.
|
||||
Often these sequences are merely components of a larger task the user is trying to accomplish.
|
||||
Such a reusable sequence is called a flow.
|
||||
</para>
|
||||
<para>
|
||||
Consider a typical shopping cart application.
|
||||
User registration, login, and cart checkout are all examples of flows that can be invoked from several places in this type of application.
|
||||
</para>
|
||||
<para>
|
||||
Spring Web Flow is the module of Spring for implementing flows.
|
||||
The Web Flow engine plugs into the Spring Web MVC platform and provides declarative flow definition language.
|
||||
This reference guide shows you how to use and extend Spring Web Flow.
|
||||
</para>
|
||||
</preface>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
||||
|
||||
<chapter id="introduction">
|
||||
<title>Introduction</title>
|
||||
@@ -332,9 +317,9 @@
|
||||
</sect2>
|
||||
<sect2>
|
||||
<title>Accessing snapshot distribution archives</title>
|
||||
<para>
|
||||
Get the snapshot zip with the most recent CI build number from the <ulink url="http://static.springframework.org/downloads/nightly/snapshot-download.php?project=SWF">Web Flow snapshot download area</ulink>.
|
||||
</para>
|
||||
</sect2>
|
||||
<para>
|
||||
Get the snapshot zip with the most recent CI build number from the <ulink url="http://static.springframework.org/downloads/nightly/snapshot-download.php?project=SWF">Web Flow snapshot download area</ulink>.
|
||||
</para>
|
||||
</sect1>
|
||||
</chapter>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?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="portlet">
|
||||
<title>Portlet Integration</title>
|
||||
<sect1 id="portlet-introduction">
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?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="spring-faces">
|
||||
<title>JSF Integration</title>
|
||||
<sect1 id="spring-faces-introduction">
|
||||
@@ -20,22 +22,22 @@
|
||||
<para>
|
||||
JSF applications using Spring Web Flow applications gain benefits in the following areas:
|
||||
<orderedlist>
|
||||
<listitem>Managed bean facility</listitem>
|
||||
<listitem>Scope management</listitem>
|
||||
<listitem>Event handling</listitem>
|
||||
<listitem>Navigation</listitem>
|
||||
<listitem>Modularization and packaging of views</listitem>
|
||||
<listitem>Cleaner URLs</listitem>
|
||||
<listitem>Model-level validation</listitem>
|
||||
<listitem>Progressivy-enhancement sytle client-side validation</listitem>
|
||||
<listitem>Progressive-enhancement style Ajax requests with partial page updates</listitem>
|
||||
<listitem><para>Managed bean facility</para></listitem>
|
||||
<listitem><para>Scope management</para></listitem>
|
||||
<listitem><para>Event handling</para></listitem>
|
||||
<listitem><para>Navigation</para></listitem>
|
||||
<listitem><para>Modularization and packaging of views</para></listitem>
|
||||
<listitem><para>Cleaner URLs</para></listitem>
|
||||
<listitem><para>Model-level validation</para></listitem>
|
||||
<listitem><para>Progressivy-enhancement sytle client-side validation</para></listitem>
|
||||
<listitem><para>Progressive-enhancement style Ajax requests with partial page updates</para></listitem>
|
||||
</orderedlist>
|
||||
|
||||
Using these features significantly reduce the amount of configuration required in faces-config.xml.
|
||||
They provide a cleaner separation between the view and controller layers along with better modularization of application functionals.
|
||||
These features are detailed in the sections to follow.
|
||||
The majority of these features build on the flow definition language of Spring Web Flow.
|
||||
Therefore it is assumed that you have an understanding of the foundations presented in <link linkend="defining-flows">Defining Flows</link>.
|
||||
Therefore it is assumed that you have an understanding of the foundations presented in <xref linkend="defining-flows"/>.
|
||||
</para>
|
||||
</sect1>
|
||||
<sect1 id="spring-faces-config-web.xml">
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?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="spring-js">
|
||||
<title>Spring JavaScript Quick Reference</title>
|
||||
<sect1 id="spring-js-introduction">
|
||||
@@ -111,7 +113,7 @@
|
||||
<para>
|
||||
This decorates the onclick event of the "Previous Results" link with an Ajax call, passing along a special parameter that specifies the fragment to be re-rendered in the response.
|
||||
Note that this link would still be fully functional if Javascript was unavailable in the client.
|
||||
(See the section on <link linkend="spring-js-ajax">Handling Ajax Requests</link> for details on how this request is handled on the server.)
|
||||
(See <xref linkend="spring-js-ajax"/> for details on how this request is handled on the server.)
|
||||
</para>
|
||||
<para>
|
||||
It is also possible to apply more than one decoration to an element.
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?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="spring-mvc">
|
||||
<title>Spring MVC Integration</title>
|
||||
<sect1 id="spring-mvc-introduction">
|
||||
@@ -313,15 +315,15 @@ public class BookingFlowHandler extends AbstractFlowHandler {
|
||||
<programlisting language="xml"><![CDATA[
|
||||
<a href="${flowExecutionUrl}&_eventId=cancel">Cancel</a>]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Firing an event results in a HTTP request being sent back to the server.
|
||||
On the server-side, the flow handles decoding the event from within its current view-state.
|
||||
How this decoding process works is specific to the view implementation.
|
||||
Recall a Spring MVC view implementation simply looks for a request parameter named <code>_eventId</code>.
|
||||
If no <code>_eventId</code> parameter is found, the view will look for a parameter that
|
||||
starts with <code>_eventId_</code> and will use the remaining substring as the event id.
|
||||
If neither cases exist, no flow event is triggered.
|
||||
</para>
|
||||
</sect2>
|
||||
<para>
|
||||
Firing an event results in a HTTP request being sent back to the server.
|
||||
On the server-side, the flow handles decoding the event from within its current view-state.
|
||||
How this decoding process works is specific to the view implementation.
|
||||
Recall a Spring MVC view implementation simply looks for a request parameter named <code>_eventId</code>.
|
||||
If no <code>_eventId</code> parameter is found, the view will look for a parameter that
|
||||
starts with <code>_eventId_</code> and will use the remaining substring as the event id.
|
||||
If neither cases exist, no flow event is triggered.
|
||||
</para>
|
||||
</sect1>
|
||||
</chapter>
|
||||
@@ -1,26 +1,6 @@
|
||||
<?xml version='1.0' encoding="iso-8859-1"?>
|
||||
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd"
|
||||
[
|
||||
<!ENTITY overview SYSTEM "overview.xml">
|
||||
<!ENTITY whatsnew SYSTEM "whatsnew.xml">
|
||||
<!ENTITY defining-flows SYSTEM "defining-flows.xml">
|
||||
<!ENTITY el SYSTEM "el.xml">
|
||||
<!ENTITY views SYSTEM "views.xml">
|
||||
<!ENTITY actions SYSTEM "actions.xml">
|
||||
<!ENTITY flow-managed-persistence SYSTEM "flow-managed-persistence.xml">
|
||||
<!ENTITY flow-security SYSTEM "flow-security.xml">
|
||||
<!ENTITY flow-inheritance SYSTEM "flow-inheritance.xml">
|
||||
<!ENTITY system-setup SYSTEM "system-setup.xml">
|
||||
<!ENTITY spring-mvc SYSTEM "spring-mvc.xml">
|
||||
<!ENTITY spring-js SYSTEM "spring-js.xml">
|
||||
<!ENTITY spring-faces SYSTEM "spring-faces.xml">
|
||||
<!ENTITY portlet SYSTEM "portlet.xml">
|
||||
<!ENTITY testing SYSTEM "testing.xml">
|
||||
<!ENTITY upgrade-guide SYSTEM "upgrade-guide.xml">
|
||||
<!ENTITY flow-definition-field-mappings SYSTEM "flow-definition-field-mappings.xml">
|
||||
]>
|
||||
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
||||
<book>
|
||||
<bookinfo>
|
||||
<title>Spring Web Flow Reference Guide</title>
|
||||
@@ -63,22 +43,40 @@
|
||||
|
||||
<toc />
|
||||
|
||||
&overview;
|
||||
&whatsnew;
|
||||
&defining-flows;
|
||||
⪙
|
||||
&views;
|
||||
&actions;
|
||||
&flow-managed-persistence;
|
||||
&flow-security;
|
||||
&flow-inheritance;
|
||||
&system-setup;
|
||||
&spring-mvc;
|
||||
&spring-js;
|
||||
&spring-faces;
|
||||
&portlet;
|
||||
&testing;
|
||||
&upgrade-guide;
|
||||
&flow-definition-field-mappings;
|
||||
<preface id="preface">
|
||||
<title>Preface</title>
|
||||
<para>
|
||||
Many web applications require the same sequence of steps to execute in different contexts.
|
||||
Often these sequences are merely components of a larger task the user is trying to accomplish.
|
||||
Such a reusable sequence is called a flow.
|
||||
</para>
|
||||
<para>
|
||||
Consider a typical shopping cart application.
|
||||
User registration, login, and cart checkout are all examples of flows that can be invoked from several places in this type of application.
|
||||
</para>
|
||||
<para>
|
||||
Spring Web Flow is the module of Spring for implementing flows.
|
||||
The Web Flow engine plugs into the Spring Web MVC platform and provides declarative flow definition language.
|
||||
This reference guide shows you how to use and extend Spring Web Flow.
|
||||
</para>
|
||||
</preface>
|
||||
|
||||
<xi:include href="overview.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="whatsnew.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="defining-flows.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="el.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="views.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="actions.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="flow-managed-persistence.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="flow-security.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="flow-inheritance.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="system-setup.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="spring-mvc.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="spring-js.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="spring-faces.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="portlet.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="testing.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="upgrade-guide.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="flow-definition-field-mappings.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
|
||||
</book>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?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="system-setup">
|
||||
<title>System Setup</title>
|
||||
<sect1 id="system-setup-introduction">
|
||||
@@ -52,10 +54,10 @@
|
||||
<programlisting language="xml"><![CDATA[
|
||||
<webflow:flow-executor id="flowExecutor" />]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
See the Spring MVC and Spring Faces sections of this guide on how to integrate the Web Flow system with the MVC and JSF environment, respectively.
|
||||
</para>
|
||||
</sect2>
|
||||
<para>
|
||||
See the Spring MVC and Spring Faces sections of this guide on how to integrate the Web Flow system with the MVC and JSF environment, respectively.
|
||||
</para>
|
||||
</sect1>
|
||||
<sect1 id="flow-registry">
|
||||
<title>flow-registry options</title>
|
||||
@@ -200,7 +202,7 @@
|
||||
Type conversion is used to convert from one type to another when required during flow execution such as when processing request parameters, invoking actions, and so on.
|
||||
Many common object types such as numbers, classes, and enums are supported.
|
||||
However you'll probably need to provide your own type conversion and formatting logic for custom data types.
|
||||
Please read the <link linkend="view-type-conversion">Performing Type Conversion</link> section for important information on how to provide custom type conversion logic.
|
||||
Please read <xref linkend="view-type-conversion"/> for important information on how to provide custom type conversion logic.
|
||||
</para>
|
||||
</sect3>
|
||||
<sect3 id="builder-service-expression-parser">
|
||||
@@ -216,11 +218,11 @@
|
||||
Use the <code>view-factory-creator</code> attribute to customize the <code>ViewFactoryCreator</code> used by the Web Flow system.
|
||||
The default ViewFactoryCreator produces Spring MVC ViewFactories capable of rendering JSP, Velocity, and Freemarker views.
|
||||
</para>
|
||||
<para>
|
||||
The configurable settings are <code>development</code>.
|
||||
These settings are global configuration attributes that can be applied during the flow construction process.
|
||||
</para>
|
||||
</sect3>
|
||||
<para>
|
||||
The configurable settings are <code>development</code>.
|
||||
These settings are global configuration attributes that can be applied during the flow construction process.
|
||||
</para>
|
||||
<sect3 id="builder-development">
|
||||
<title>development</title>
|
||||
<para>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?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="testing">
|
||||
<title>Testing flows</title>
|
||||
<sect1 id="testing-introduction">
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?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="upgrade-guide">
|
||||
<title>Upgrading from 1.0</title>
|
||||
<sect1 id="upgrade-guide-introduction">
|
||||
@@ -68,7 +70,7 @@ java org.springframework.webflow.upgrade.WebFlowUpgrader flow-to-upgrade.xml
|
||||
All spring beans can be resolved via EL.
|
||||
</para>
|
||||
</sect4>
|
||||
<sect4 id="upgrade-guide-definition-language-tool-warnings-var=scope">
|
||||
<sect4 id="upgrade-guide-definition-language-tool-warnings-var-scope">
|
||||
<title>var scope is no longer supported</title>
|
||||
<para>
|
||||
The var element will place all variable into flow scope.
|
||||
@@ -240,7 +242,7 @@ java org.springframework.webflow.upgrade.WebFlowUpgrader flow-to-upgrade.xml
|
||||
Web Flow 2 adds support for Unified EL.
|
||||
Web Flow 2.1 uses Spring EL by default.
|
||||
United EL and OGNL can still be plugged in.
|
||||
Please see the <link linkend="el">Expression Language</link> chapter for details.
|
||||
Please see <xref linkend="el"/> for details.
|
||||
</para>
|
||||
</sect2>
|
||||
<sect2 id="upgrade-guide-webflow-concepts-flash-scope">
|
||||
@@ -256,7 +258,7 @@ java org.springframework.webflow.upgrade.WebFlowUpgrader flow-to-upgrade.xml
|
||||
<title>JSF</title>
|
||||
<para>
|
||||
Web Flow 2 offers significantly improved integration with JSF.
|
||||
Please see the <link linkend="spring-faces">JSF Integration</link> chapter for details.
|
||||
Please see <xref linkend="spring-faces"/> for details.
|
||||
</para>
|
||||
</sect2>
|
||||
<sect2 id="upgrade-guide-webflow-concepts-redirects">
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<?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="views">
|
||||
<title>Rendering views</title>
|
||||
<sect1 id="views-introduction">
|
||||
@@ -329,8 +331,10 @@ public class ApplicationConversionServiceFactoryBean extends FormattingConversio
|
||||
<para>
|
||||
Web developers will find the <code>Formatter</code> interface most relevant because it fits the needs of web applications for type conversion.
|
||||
<note>
|
||||
An important point to be made is that Object-to-Object conversion is a generalization of the more specific Object-to-String conversion.
|
||||
In fact in the end <code>Formatters</code> are reigstered as <code>GenericConverter</code> types with Spring's <code>GenericConversionService</code> making them equal to any other converter.
|
||||
<para>
|
||||
An important point to be made is that Object-to-Object conversion is a generalization of the more specific Object-to-String conversion.
|
||||
In fact in the end <code>Formatters</code> are reigstered as <code>GenericConverter</code> types with Spring's <code>GenericConversionService</code> making them equal to any other converter.
|
||||
</para>
|
||||
</note>
|
||||
</para>
|
||||
</sect2>
|
||||
@@ -454,7 +458,7 @@ public class ApplicationConversionServiceFactoryBean extends FormattingConversio
|
||||
The second is to implement an external <code>Validator</code>.
|
||||
Both ways provide you with a <code>ValidationContext</code> to record error messages and access information about the current user.
|
||||
</para>
|
||||
<sect3 id="view-validation=programmatic-validate-method">
|
||||
<sect3 id="view-validation-programmatic-validate-method">
|
||||
<title>Implementing a model validate method</title>
|
||||
<para>
|
||||
Defining validation logic in your model object is the simplest way to validate its state.
|
||||
@@ -462,8 +466,7 @@ public class ApplicationConversionServiceFactoryBean extends FormattingConversio
|
||||
Web Flow conventions have you structure model validation logic by view-state, allowing you to easily validate the subset of model properties that are editable on that view.
|
||||
To do this, simply create a public method with the name <code>validate${state}</code>, where <code>${state}</code> is the id of your view-state where you want validation to run.
|
||||
For example:
|
||||
</para>
|
||||
<programlisting language="java"><![CDATA[
|
||||
<programlisting language="java"><![CDATA[
|
||||
public class Booking {
|
||||
private Date checkinDate;
|
||||
private Date checkoutDate;
|
||||
@@ -481,23 +484,24 @@ public class Booking {
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
In the example above, when a transition is triggered in a <code>enterBookingDetails</code> view-state that is editing a <code>Booking</code> model,
|
||||
Web Flow will invoke the <code>validateEnterBookingDetails(ValidationContext)</code> method automatically unless validation has been suppressed for that transition.
|
||||
An example of such a view-state is shown below:
|
||||
</para>
|
||||
<programlisting language="xml"><![CDATA[
|
||||
<programlisting language="xml"><![CDATA[
|
||||
<view-state id="enterBookingDetails" model="booking">
|
||||
<transition on="proceed" to="reviewBooking">
|
||||
</view-state>]]>
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
Any number of validation methods are defined. Generally, a flow edits a model over a series of views. In that case, a validate method would be defined
|
||||
for each view-state where validation needs to run.
|
||||
</para>
|
||||
</sect3>
|
||||
<sect3 id="view-validation=programmatic-validator">
|
||||
<sect3 id="view-validation-programmatic-validator">
|
||||
<title>Implementing a Validator</title>
|
||||
<para>
|
||||
The second way is to define a separate object, called a <emphasis>Validator</emphasis>, which validates your model object.
|
||||
@@ -534,6 +538,38 @@ public class BookingValidator {
|
||||
Then, anytime the <code>booking</code> model needs to be validated, this <code>bookingValidator</code> instance would be invoked for you.
|
||||
</para>
|
||||
</sect3>
|
||||
<sect3 id="default-validate-method">
|
||||
<title>Default validate method</title>
|
||||
<para>
|
||||
Within a <emphasis>Validator</emphasis> class, it is also possible to define a method called <code>validate</code> that does not refer to any specific view-state.
|
||||
</para>
|
||||
<programlisting language="java"><![CDATA[
|
||||
@Component
|
||||
public class BookingValidator {
|
||||
public void validate(Booking booking, ValidationContext context) {
|
||||
//...
|
||||
}
|
||||
}]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
In the upper code sample, the method <code>validate</code> will be called every time a Model of type <code>Booking</code> is being called (unless validation has been suppressed for that transition).
|
||||
If needed, the default method can also be called in addition to an existing state-specific method. Consider the following example:
|
||||
</para>
|
||||
<programlisting language="java"><![CDATA[
|
||||
@Component
|
||||
public class BookingValidator {
|
||||
public void validate(Booking booking, ValidationContext context) {
|
||||
//...
|
||||
}
|
||||
public void validateEnterBookingDetails(Booking booking, ValidationContext context) {
|
||||
//...
|
||||
}
|
||||
}]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
In the upper code sample, the method <code>validateEnterBookingDetails</code> will be called first. After that, the default <code>validate</code> method will be called.
|
||||
</para>
|
||||
</sect3>
|
||||
</sect2>
|
||||
<sect2 id="view-validation-context">
|
||||
<title>ValidationContext</title>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?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="whatsnew">
|
||||
<title>What's New In Spring Web Flow 2.1</title>
|
||||
<sect1 id="whatsnew-versions">
|
||||
@@ -76,7 +77,7 @@
|
||||
Existing applications can still choose to plug in the Unified EL or OGNL if they wish to do so.
|
||||
Spring EL however is the recommended approach.
|
||||
It offers advantages such as close integration with the Spring 3 Type Conversion and Formatting system and is also used in other Spring projects.
|
||||
For more information see the <link linkend="el">Expression Language (EL)</link> chapter.
|
||||
For more information see <xref linkend="el"/>.
|
||||
</para>
|
||||
</sect2>
|
||||
<sect2>
|
||||
@@ -89,19 +90,17 @@
|
||||
<para>
|
||||
Existing applications can continue to use the custom converters they currently have.
|
||||
With the new approach however, they can now use a single mechanism across Spring MVC controllers and flow definitions.
|
||||
For more information see the <link linkend="view-type-conversion">Performing Type Conversion</link> chapter.
|
||||
For more information see <xref linkend="view-type-conversion"/>.
|
||||
</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
<sect1 id="whatsnew-tiles">
|
||||
<title>Tiles Updates</title>
|
||||
<sect2>
|
||||
<para>
|
||||
Spring Web Flow 2.1 provides support for Tiles 2.1.2.
|
||||
It has contains important features that can help reduce Tiles related configuration.
|
||||
This includes wildcard support when listing Tiles definition files or when defining Tiles definitions, anonymous and cascaded nested definitions among others.
|
||||
See <ulink url="http://tiles.apache.org/2.1/framework/whats-new.html">What's new in Tiles 2.1</ulink> for more details.
|
||||
</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
</chapter>
|
||||
|
||||
Reference in New Issue
Block a user