SWF-1374 Updated documentation for 2.2.0, deprecated ResourceServlet.
This commit is contained in:
@@ -48,6 +48,9 @@ import org.springframework.web.servlet.HttpServletBean;
|
||||
*
|
||||
* @author Jeremy Grelle
|
||||
* @author Scott Andrews
|
||||
*
|
||||
* @deprecated Deprecated in favor of the new resource handling mechanism available in Spring 3.0.4. See the
|
||||
* documentation on the custom mvc namespace, specifically the new resources element.
|
||||
*/
|
||||
public class ResourceServlet extends HttpServletBean {
|
||||
|
||||
|
||||
@@ -5,5 +5,6 @@ Import-Bundle:
|
||||
org.springframework.binding;version="[@bundle.version@, @bundle.version@]",
|
||||
org.springframework.webflow;version="[@bundle.version@, @bundle.version@]",
|
||||
org.springframework.js;version="[@bundle.version@, @bundle.version@]";resolution:="optional",
|
||||
org.springframework.js.resources;version="[@bundle.version@, @bundle.version@]";resolution:="optional",
|
||||
org.springframework.faces;version="[@bundle.version@, @bundle.version@]";resolution:="optional",
|
||||
com.springsource.org.jboss.el;version="[2.0.0.GA, 2.1.0)";resolution:="optional"
|
||||
|
||||
@@ -52,21 +52,9 @@
|
||||
This allows you to easily integrate Web Flow into your application if you are already using Maven as the build system for your web development project.
|
||||
</para>
|
||||
<para>
|
||||
To access Web Flow jars from Maven Central, declare the following dependencies in your pom:
|
||||
To access Web Flow jars from Maven Central, declare the following dependency in your pom (also adds "spring-binding", "spring-js", and "spring-js-resources"):
|
||||
</para>
|
||||
<programlisting language="xml"><![CDATA[
|
||||
<dependency>
|
||||
<groupId>org.springframework.webflow</groupId>
|
||||
<artifactId>spring-binding</artifactId>
|
||||
<version>2.2.0.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.webflow</groupId>
|
||||
<artifactId>spring-js</artifactId>
|
||||
<version>2.2.0.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.webflow</groupId>
|
||||
<artifactId>spring-webflow</artifactId>
|
||||
@@ -75,7 +63,7 @@
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
And if using JavaServerFaces:
|
||||
If using JavaServer Faces, declare the following dependency in your pom (also adds the above dependencies):
|
||||
</para>
|
||||
<programlisting language="xml"><![CDATA[
|
||||
<dependency>
|
||||
@@ -112,21 +100,9 @@
|
||||
</repository>]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Then declare the following dependencies:
|
||||
Then declare the following dependency:
|
||||
</para>
|
||||
<programlisting language="xml"><![CDATA[
|
||||
<dependency>
|
||||
<groupId>org.springframework.webflow</groupId>
|
||||
<artifactId>org.springframework.binding</artifactId>
|
||||
<version>2.2.0.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.webflow</groupId>
|
||||
<artifactId>org.springframework.js</artifactId>
|
||||
<version>2.2.0.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.webflow</groupId>
|
||||
<artifactId>org.springframework.webflow</artifactId>
|
||||
@@ -134,7 +110,7 @@
|
||||
</dependency>]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
And if using JavaServerFaces:
|
||||
And if using JavaServer Faces:
|
||||
</para>
|
||||
<programlisting language="xml"><![CDATA[
|
||||
<dependency>
|
||||
@@ -169,13 +145,10 @@
|
||||
</url>]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Then declare the following dependencies:
|
||||
Then declare the following dependencies (also adds "org.springframework.binding",
|
||||
"org.springframework.js", and "org.springframework.spring.js"):
|
||||
</para>
|
||||
<programlisting language="xml"><![CDATA[
|
||||
<dependency org="org.springframework.webflow" name="org.springframework.binding"
|
||||
rev="2.2.0.RELEASE" conf="compile->runtime" />
|
||||
<dependency org="org.springframework.webflow" name="org.springframework.js"
|
||||
rev="2.2.0.RELEASE" conf="compile->runtime" />
|
||||
<dependency org="org.springframework.webflow" name="org.springframework.webflow"
|
||||
rev="2.2.0.RELEASE" conf="compile->runtime" />]]>
|
||||
</programlisting>
|
||||
|
||||
@@ -185,6 +185,58 @@ externalContext.requestMap.portletMode
|
||||
]]></programlisting>
|
||||
</sect2>
|
||||
</sect1>
|
||||
<sect1 id="portlet-jsf">
|
||||
<title>Using Portlets with JSF</title>
|
||||
<sect2 id="portlet-jsf-using-portlet-jsf">
|
||||
<para>
|
||||
Prior to version 2.1 of Spring Web Flow, support for JSF Portlets was considered
|
||||
experimental and relied on a Portlet Bridge for JSF implementation.
|
||||
Furthermore JSR-329 (the latest specification in this area), which targets
|
||||
Portlet API 2.0 and JSF 1.2 environments at the time of writing is not yet
|
||||
final causing portlet bridge implementations to also remain incomplete.
|
||||
</para>
|
||||
<para>
|
||||
A closer comparison of Spring Web Flow and a Portlet Bridge for JSF shows
|
||||
the two have significant overlap. They both drive the
|
||||
JSF lifecycle and they both shield JSF from knowledge about Portlet action
|
||||
and render requests.
|
||||
</para>
|
||||
<para>
|
||||
Considering all of the above, starting with version 2.2, Spring Web Flow
|
||||
provides support for JSF Portlets using its own internal Portlet integration rather
|
||||
than a Portlet Bridge for JSF. We believe this will provide value for Web Flow users
|
||||
by reducing the number of dependencies in what is already a fairly complex
|
||||
combination of technologies with specifications lagging behind.
|
||||
</para>
|
||||
<para>
|
||||
What this practically means is the configuration required for JSF Portlets is
|
||||
very similar to what is alread documented in the rest of this chapter
|
||||
with the exception of <xref linkend="portlet-views"/>, which is not necessary
|
||||
with JSF.
|
||||
</para>
|
||||
<para>
|
||||
Review the <code>swf-booking-portlet-faces</code> sample in the Web Flow distribution
|
||||
for a working JSF Portlets example with complete configuration details. The main thing
|
||||
you'll need to notice in addition to what has already been described in this
|
||||
chapter is the <code>faces-config.xml</code> configuration:
|
||||
</para>
|
||||
|
||||
<programlisting language="java"><![CDATA[<?xml version="1.0"?>
|
||||
<!DOCTYPE faces-config PUBLIC
|
||||
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
|
||||
"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
|
||||
|
||||
<faces-config>
|
||||
<application>
|
||||
<view-handler>
|
||||
org.springframework.faces.webflow.application.portlet.PortletFaceletViewHandler
|
||||
</view-handler>
|
||||
</application>
|
||||
</faces-config>
|
||||
]]></programlisting>
|
||||
|
||||
</sect2>
|
||||
</sect1>
|
||||
<sect1 id="portlet-issues">
|
||||
<title>Issues in a Portlet Environment</title>
|
||||
<sect2 id="portlet-issues-redirects">
|
||||
@@ -213,17 +265,5 @@ externalContext.requestMap.portletMode
|
||||
One way to start a new flow is to create a URL targeting the mode without the execution key.
|
||||
</para>
|
||||
</sect2>
|
||||
<sect2 id="portlet-issues-jsf">
|
||||
<title>Portlets and JSF</title>
|
||||
<para>
|
||||
Web Flow supports JSF as the view technology for a portlet.
|
||||
However, a jsf-portlet bridge (JSR-301) must be provided.
|
||||
At the time of this writing, no feature complete jsf-portlet bridge exists.
|
||||
Some of the existing bridge implementations may appear to work, however, side effect may occur.
|
||||
</para>
|
||||
<para>
|
||||
JSF portlets are considered experimental at this time.
|
||||
</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
</chapter>
|
||||
|
||||
@@ -6,11 +6,24 @@
|
||||
<sect1 id="spring-faces-introduction">
|
||||
<title>Introduction</title>
|
||||
<para>
|
||||
Spring Web Flow provides an integration that simplifies using JSF with Spring. It lets you use the
|
||||
JSF UI Component Model with Spring MVC and Spring Web Flow controllers.
|
||||
Spring Web Flow provides an integration that simplifies using with Spring. It lets you use the
|
||||
JSF UI Component Model with Spring MVC and Spring Web Flow controllers. As of Spring Web Flow
|
||||
2.2 the JSF integration is supported with JSF 1.2 and JSF 2.0 including Sun Mojarra and Apache
|
||||
MyFaces. Please, note however that JSF 2 partial state saving is not yet supported with
|
||||
Apache MyFaces and needs to be disabled with the <code>javax.faces.PARTIAL_STATE_SAVING</code>
|
||||
context parameter in <code>web.xml</code>
|
||||
</para>
|
||||
<para>
|
||||
A small Facelets component library that provides Ajax and client-side validation capabilities is also shipped with Web Flow.
|
||||
Spring Web Flow provides a Spring Security tag library for JSF 2 and JSF 1.2 environments.
|
||||
It provides an <authorize> tag as well as several EL functions.
|
||||
See <xref linkend="spring-faces-security-taglib"/> for more details.
|
||||
</para>
|
||||
<para>
|
||||
A small Facelets component library that provides Ajax and client-side validation capabilities
|
||||
in JSF 1.2 environments only is also shipped with Web Flow. Note that this library will not
|
||||
be upgraded to JSF 2.0 in favor of 3rd party component libraries such as PrimeFaces
|
||||
and RichFaces. The <code>swf-booking-faces</code> sample in the Spring Web Flow distribution
|
||||
is built on JSF 2 and PrimeFaces components.
|
||||
</para>
|
||||
</sect1>
|
||||
<sect1 id="spring-faces-integration">
|
||||
@@ -87,7 +100,7 @@
|
||||
</servlet-mapping>]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
When using the Spring Faces components, you also need to configure a servlet for serving
|
||||
When using the Spring Faces components (JSF 1.2 only), you also need to configure a servlet for serving
|
||||
CSS and JavaScript resources. This servlet must be mapped
|
||||
to /resources/* in order for the URL's rendered by the components to function correctly.
|
||||
</para>
|
||||
@@ -118,7 +131,8 @@
|
||||
</programlisting>
|
||||
<para>
|
||||
For optimal page-loading performance use the Spring Faces components
|
||||
<code>includeStyles</code> and <code>includeScripts</code>. These components will eagerly load the necessary
|
||||
<code>includeStyles</code> and <code>includeScripts</code> (JSF 1.2 only).
|
||||
These components will eagerly load the necessary
|
||||
CSS stylesheets and JavaScript files at the position they are placed in your JSF view template. In accordance
|
||||
with the recommendations of the Yahoo Performance Guildlines, these two tags should be placed in the <code>head</code>
|
||||
section of any page that uses the Spring Faces components. For example:
|
||||
@@ -163,48 +177,89 @@
|
||||
</para>
|
||||
</sect1>
|
||||
<sect1 id="spring-faces-webflow-config">
|
||||
<title>Configuring Web Flow to render JSF views</title>
|
||||
<title>Configuring Web Flow for use with JSF</title>
|
||||
<para>
|
||||
The next step is to configure Web Flow to render JSF views. To do this, in your Spring Web Flow
|
||||
configuration include the
|
||||
<code>faces</code>
|
||||
namespace and link in the
|
||||
<code>flow-builder-services</code> element from the faces custom namespace.
|
||||
:
|
||||
This section explains how to configure Web Flow with JSF.
|
||||
The next section provides more details specific to using Web Flow with JSF 2.
|
||||
The following is sample configuration for Web Flow and JSF:
|
||||
</para>
|
||||
<programlisting language="xml"><![CDATA[
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:webflow="http://www.springframework.org/schema/webflow-config"
|
||||
xmlns:faces="http://www.springframework.org/schema/faces"
|
||||
si:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://www.springframework.org/schema/webflow-config
|
||||
http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd
|
||||
http://www.springframework.org/schema/faces
|
||||
http://www.springframework.org/schema/faces/spring-faces-2.0.xsd">
|
||||
|
||||
<!-- Executes flows: the central entry point into the Spring Web Flow system -->
|
||||
<webflow:flow-executor id="flowExecutor">
|
||||
<webflow:flow-execution-listeners>
|
||||
<webflow:listener ref="facesContextListener"/>
|
||||
</webflow:flow-execution-listeners>
|
||||
</webflow:flow-executor>
|
||||
|
||||
<!-- The registry of executable flow definitions -->
|
||||
<webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices" base-path="/WEB-INF">
|
||||
<webflow:flow-location-pattern value="**/*-flow.xml" />
|
||||
</webflow:flow-registry>
|
||||
|
||||
<!-- Configures the Spring Web Flow JSF integration -->
|
||||
<faces:flow-builder-services id="flowBuilderServices" />
|
||||
|
||||
<!-- A listener maintain one FacesContext instance per Web Flow request. -->
|
||||
<bean id="facesContextListener"
|
||||
class="org.springframework.faces.webflow.FlowFacesContextLifecycleListener" />
|
||||
|
||||
</beans>]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The main points are the installation of a <code>FlowFacesContextLifecycleListener</code> that
|
||||
manages a single FacesContext for the duration of Web Flow request and the
|
||||
use of the <code>flow-builder-services</code> element from the <code>faces</code> custom
|
||||
namespace to configure rendering for a JSF environment.
|
||||
</para>
|
||||
<para>
|
||||
See the swf-booking-faces reference application in the distribution for a complete working example.
|
||||
</para>
|
||||
</sect1>
|
||||
<sect1 id="spring-faces-webflow-config-jsf2">
|
||||
<title>Configuring Spring MVC for use with JSF 2</title>
|
||||
<para>
|
||||
In a JSF 2 environment you'll also need this Spring MVC related configuration:
|
||||
</para>
|
||||
<programlisting language="xml"><![CDATA[
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:webflow="http://www.springframework.org/schema/webflow-config"
|
||||
xmlns:faces="http://www.springframework.org/schema/faces"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://www.springframework.org/schema/webflow-config
|
||||
http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd
|
||||
http://www.springframework.org/schema/faces
|
||||
http://www.springframework.org/schema/faces/spring-faces-2.0.xsd">
|
||||
|
||||
<!-- Executes flows: the central entry point into the Spring Web Flow system -->
|
||||
<webflow:flow-executor id="flowExecutor" />
|
||||
|
||||
<!-- The registry of executable flow definitions -->
|
||||
<webflow:flow-registry id="flowRegistry" flow-builder-services="facesFlowBuilderServices" base-path="/WEB-INF">
|
||||
<webflow:flow-location-pattern value="**/*-flow.xml" />
|
||||
</webflow:flow-registry>
|
||||
|
||||
<!-- Configures the Spring Web Flow JSF integration -->
|
||||
<faces:flow-builder-services id="facesFlowBuilderServices" />
|
||||
<faces:resources />
|
||||
|
||||
<bean class="org.springframework.faces.webflow.JsfFlowHandlerAdapter">
|
||||
<property name="flowExecutor" ref="flowExecutor" />
|
||||
</bean>
|
||||
|
||||
</beans>]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The <code>faces:flow-builder-services</code> tag also configures several other defaults appropriate for a JSF environment.
|
||||
The <code>resources</code> custom namespace element delegates JSF 2 resource
|
||||
requests to the JSF 2 resource API. The <code>JsfFlowHandlerAdapter</code>
|
||||
is a replacement for the <code>FlowHandlerAdapter</code> normally used with
|
||||
Web Flow. This adapter initializes itself with a <code>JsfAjaxHandler</code> instead
|
||||
of the <code>SpringJavaSciprtAjaxHandler</code> previously used with Spring
|
||||
Faces components.
|
||||
</para>
|
||||
<para>
|
||||
See the swf-booking-faces reference application in the distribution for a complete working example.
|
||||
</para>
|
||||
</sect1>
|
||||
<sect1 id="spring-faces-config">
|
||||
<title>Configuring faces-config.xml</title>
|
||||
@@ -626,6 +681,118 @@
|
||||
</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
<sect1 id="spring-faces-security-taglib">
|
||||
<title>Using the Spring Security Facelets Tag Library</title>
|
||||
<para>
|
||||
To use the library you'll need to create a <code>.taglib.xml</code> file and register it in <code>web.xml</code>.
|
||||
Unfortunately Spring Web Flow cannot easily do this automatically without causing issues for
|
||||
either JSF 2 or JSF 1.2 users. In a future release we will consider splitting the security tag
|
||||
library into a separate artifact with JSF 1.2 and 2.0 versions to make the library easier to add.
|
||||
</para>
|
||||
<para>
|
||||
Note: all instructions you will see in this section assume you already know how
|
||||
to configure Spring Security itself.
|
||||
</para>
|
||||
<para>
|
||||
For JSF 2 save the following as <code>/WEB-INF/springsecurity.taglib.xml</code>:
|
||||
</para>
|
||||
<programlisting language="xml"><![CDATA[<?xml version="1.0"?>
|
||||
<!DOCTYPE facelet-taglib PUBLIC
|
||||
"-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
|
||||
"http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
|
||||
<facelet-taglib>
|
||||
<namespace>http://www.springframework.org/security/tags</namespace>
|
||||
<tag>
|
||||
<tag-name>authorize</tag-name>
|
||||
<handler-class>org.springframework.faces.security.FaceletsAuthorizeTagHandler</handler-class>
|
||||
</tag>
|
||||
<function>
|
||||
<function-name>areAllGranted</function-name>
|
||||
<function-class>org.springframework.faces.security.FaceletsAuthorizeTagUtils</function-class>
|
||||
<function-signature>boolean areAllGranted(java.lang.String)</function-signature>
|
||||
</function>
|
||||
<function>
|
||||
<function-name>areAnyGranted</function-name>
|
||||
<function-class>org.springframework.faces.security.FaceletsAuthorizeTagUtils</function-class>
|
||||
<function-signature>boolean areAnyGranted(java.lang.String)</function-signature>
|
||||
</function>
|
||||
<function>
|
||||
<function-name>areNotGranted</function-name>
|
||||
<function-class>org.springframework.faces.security.FaceletsAuthorizeTagUtils</function-class>
|
||||
<function-signature>boolean areNotGranted(java.lang.String)</function-signature>
|
||||
</function>
|
||||
<function>
|
||||
<function-name>isAllowed</function-name>
|
||||
<function-class>org.springframework.faces.security.FaceletsAuthorizeTagUtils</function-class>
|
||||
<function-signature>boolean isAllowed(java.lang.String, java.lang.String)</function-signature>
|
||||
</function>
|
||||
</facelet-taglib>
|
||||
]]></programlisting>
|
||||
<para>
|
||||
For JSF 1.2 use the same content as shown above but replace <code>FaceletsAuthorizeTagHandler</code> with
|
||||
<code>Jsf12FaceletsAuthorizeTagHandler</code> and <code>FaceletsAuthorizeTagUtils</code> wiht
|
||||
<code>Jsf12FaceletsAuthorizeTagUtils</code>.
|
||||
</para>
|
||||
<para>
|
||||
Register the above file in web.xml:
|
||||
</para>
|
||||
<programlisting language="xml"><![CDATA[<context-param>
|
||||
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
|
||||
<param-value>/WEB-INF/springsecurity.taglib.xml</param-value>
|
||||
</context-param>
|
||||
]]></programlisting>
|
||||
<para>
|
||||
Now you are ready to use the tag library in your views.
|
||||
You can use the authorize tag to include nested content conditionally:
|
||||
</para>
|
||||
<programlisting language="xml"><![CDATA[<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:sec="http://www.springframework.org/security/tags">
|
||||
|
||||
<sec:authorize ifAllGranted="ROLE_FOO, ROLE_BAR">
|
||||
Lorem ipsum dolor sit amet
|
||||
</sec:authorize>
|
||||
|
||||
<sec:authorize ifNotGranted="ROLE_FOO, ROLE_BAR">
|
||||
Lorem ipsum dolor sit amet
|
||||
</sec:authorize>
|
||||
|
||||
<sec:authorize ifAnyGranted="ROLE_FOO, ROLE_BAR">
|
||||
Lorem ipsum dolor sit amet
|
||||
</sec:authorize>
|
||||
|
||||
</ui:composition>
|
||||
]]></programlisting>
|
||||
|
||||
<para>
|
||||
You can also use one of several EL functions in the rendered or other
|
||||
attribute of any JSF component:
|
||||
</para>
|
||||
|
||||
<programlisting language="xml"><![CDATA[<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:h="http://java.sun.com/jsf/html"
|
||||
xmlns:sec="http://www.springframework.org/security/tags">
|
||||
|
||||
<!-- Rendered only if user has all of the listed roles -->
|
||||
<h:outputText value="Lorem ipsum dolor sit amet" rendered="#{sec:areAllGranted('ROLE_FOO, ROLE_BAR')}"/>
|
||||
|
||||
<!-- Rendered only if user does not have any of the listed roles -->
|
||||
<h:outputText value="Lorem ipsum dolor sit amet" rendered="#{sec:areNotGranted('ROLE_FOO, ROLE_BAR')}"/>
|
||||
|
||||
<!-- Rendered only if user has any of the listed roles -->
|
||||
<h:outputText value="Lorem ipsum dolor sit amet" rendered="#{sec:areAnyGranted('ROLE_FOO, ROLE_BAR')}"/>
|
||||
|
||||
<!-- Rendered only if user has access to given HTTP method/URL as defined in Spring Security configuration -->
|
||||
<h:outputText value="Lorem ipsum dolor sit amet" rendered="#{sec:isAllowed('/secured/foo', 'POST')}"/>
|
||||
|
||||
</ui:composition>
|
||||
]]></programlisting>
|
||||
|
||||
</sect1>
|
||||
<sect1 id="spring-faces-ui-controls">
|
||||
<title>Enhancing The User Experience With Rich Web Forms</title>
|
||||
<para>
|
||||
|
||||
@@ -2,105 +2,122 @@
|
||||
<!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>
|
||||
<title>What's New In Spring Web Flow 2.2.0</title>
|
||||
<sect1 id="whatsnew-jsf2">
|
||||
<title>JSF 2 Support</title>
|
||||
<sect2>
|
||||
<title>Comprehensive JSF 2 Support</title>
|
||||
<para>
|
||||
Building on 2.1, Spring Web Flow version 2.2 adds support for core JSF 2 features
|
||||
The following features that were not supported in 2.1 are now available:
|
||||
partial state saving, JSF 2 resource request, handling, and JSF 2 Ajax requests.
|
||||
At this point support for JSF 2 is considered
|
||||
comprehensive although not covering every JSF 2 feature --
|
||||
excluded are mostly features that overlap with the core value Web Flow provides
|
||||
such as those relating to navigation and state management.
|
||||
</para>
|
||||
<para>
|
||||
See <xref linkend="spring-faces-webflow-config"/> for important configuration changes.
|
||||
Note that partial state saving is only supported with Sun Mojarra 2.0.3 or later.
|
||||
It is not yet supported with Apache MyFaces. This is due to the
|
||||
fact MyFaces was not as easy to customize with regards to how component state is stored.
|
||||
We will work with Apache MyFaces to provide this support. In the mean time you will need to use
|
||||
the <code>javax.faces.PARTIAL_STATE_SAVING</code> context parameter in <code>web.xml</code>
|
||||
to disable partial state saving with Apache MyFaces.
|
||||
</para>
|
||||
</sect2>
|
||||
<sect2>
|
||||
<title>Travel Sample With the PrimeFaces Components</title>
|
||||
<para>
|
||||
The main Spring Travel sample demonstrating Spring Web Flow and JSF support
|
||||
is now built on JSF 2 and components from the PrimeFaces component library.
|
||||
Please check out the booking-faces sample in the distribution.
|
||||
</para>
|
||||
<para>
|
||||
Additional samples can be found at the Spring Web Flow - Prime Faces
|
||||
<ulink url="https://src.springframework.org/svn/spring-samples/webflow-primefaces-showcase">
|
||||
Showcase</ulink>, an SVN repository within the
|
||||
<ulink url="https://src.springframework.org/svn/spring-samples">spring-samples</ulink>
|
||||
repository. Use these commands to check out and build:
|
||||
</para>
|
||||
<programlisting><![CDATA[svn co https://src.springframework.org/svn/spring-samples/webflow-primefaces-showcase
|
||||
cd webflow-primefaces-showcase
|
||||
mvn package
|
||||
]]></programlisting>
|
||||
|
||||
</sect2>
|
||||
</sect1>
|
||||
<sect1 id="whatsnew-sec">
|
||||
<title>Spring Security Facelets Tag Library</title>
|
||||
<para>
|
||||
A new Spring Security tag library is available for use with with JSF 2.0 or with JSF 1.2 Facelets views.
|
||||
It provides an <authorize> tag as well as several EL functions.
|
||||
See <xref linkend="spring-faces-security-taglib"/> for more details.
|
||||
</para>
|
||||
</sect1>
|
||||
<sect1 id="whatsnew-versions">
|
||||
<title>Version Upgrades</title>
|
||||
<title>Spring JavaScript Updates</title>
|
||||
<sect2>
|
||||
<title>Spring Version Changes</title>
|
||||
<title>Deprecated ResourcesServlet</title>
|
||||
<para>
|
||||
Spring Web Flow 2.1 is built on Spring 3 that in turn requires Java 5.
|
||||
Starting with Spring 3.0.4, the Spring Framework includes
|
||||
a replacement for the ResourcesServlet. Please see
|
||||
the Spring Framework documentation for details on the custom mvc namespace,
|
||||
specifically the new
|
||||
<ulink url="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html#mvc-static-resources">"resources"</ulink>
|
||||
element.
|
||||
</para>
|
||||
</sect2>
|
||||
<sect2>
|
||||
<title>Spring Security Version Changes</title>
|
||||
<title>Dojo 1.5 and dojox</title>
|
||||
<para>
|
||||
Spring Web Flow 2.1 is built on Spring Security 3.
|
||||
Due to package changes in Spring Security this release is not backwards compatible with prior versions of Spring Security.
|
||||
The bundled custom Dojo build is upgraded to version 1.5. It now includes dojox.
|
||||
</para>
|
||||
<para>
|
||||
Note that applications are generally encouraged to prepare their own custom
|
||||
Dojo build for optimized performance depending on what parts of Dojo are
|
||||
commonly used together. For examples see the
|
||||
<ulink url="https://src.springframework.org/svn/spring-webflow/branches/spring-webflow-2.2-maintenance/spring-js-resources/scripts/dojo">scripts</ulink>
|
||||
used by Spring Web Flow to prepare its own custom Dojo build.
|
||||
</para>
|
||||
</sect2>
|
||||
<sect2>
|
||||
<title>Tiles Version Changes</title>
|
||||
<title>Two Spring JS artifacts</title>
|
||||
<para>
|
||||
Spring Web Flow 2.1 is built on Spring 3, which in turn requires Tiles 2.1.2 (or higher).
|
||||
Due to incompatible API changes in Tiles 2.1.2 this release is not backwards compatible with prior versions of Tiles.
|
||||
The <code>spring-js</code> artifact has been split in two -- the new artifact
|
||||
(<code>spring-js-resources</code>) contains client side resource (.js, .css, etc.) while
|
||||
the existing artifact (<code>spring-js</code>) contains server-side Java code only.
|
||||
</para>
|
||||
<para>
|
||||
Applications preparing their own custom Dojo build have an option now to
|
||||
avoid including <code>spring-js-resources</code> and put <code>Spring.js</code> and
|
||||
<code>Spring-Dojo.js</code> directly under the root of their web application.
|
||||
</para>
|
||||
</sect2>
|
||||
<sect2>
|
||||
<title>JSF Version Changes</title>
|
||||
<title>Client resources moved into META-INF/web-resources</title>
|
||||
<para>
|
||||
Spring Web Flow 2.1 provides initial support for JSF 2 and aims to maintains backwards compatibility with JSF 1.2 while JSF 1.1 will no longer be officially targeted.
|
||||
</para>
|
||||
<para>
|
||||
Initial support for JSF 2 means the ability use Mojarra or Apache MyFaces JSF 2 dependencies along with the Faceletes implementation officially bundled with JSF 2 jars.
|
||||
That means any separate Facelets libraries such as <code>com.sun.facelets</code> (the one containing <code>com.sun.facelets.FaceletViewHandler</code>) can be removed from the project dependencies.
|
||||
Please see the <code>booking-faces</code> Web Flow sample, which is configured to run with Mojarra 2.0.
|
||||
The <code>ivy.xml</code> included in the sample has configuration and notes on how to recompile for Mojarra 1.2 or with Apache MyFaces.
|
||||
The recommended version of Apache MyFaces 2 to use is 2.0.1.SNAPSHOT due to <ulink url="https://issues.apache.org/jira/browse/MYFACES-2686">MYFACES-2686</ulink>.
|
||||
</para>
|
||||
<para>
|
||||
Partial state saving is a new feature that is enabled by default in JSF 2.
|
||||
This feature is not yet supported in Spring Web Flow and must be disabled through a servlet configuration parameter as is shown the <code>booking-faces</code> sample.
|
||||
</para>
|
||||
<para>
|
||||
In version 2.1 Spring Web Flow doesn't explicitly target any JSF 2 features.
|
||||
Some features such as composite components, JSR 303 validation, and others may work while others such as the new Ajax support probably won't.
|
||||
The goal of this release is to be an intermediate step with more meaningful JSF 2 support to follow in subsequent releases.
|
||||
</para>
|
||||
<para>
|
||||
What this does is it allows applications to begin the migration to JSF 2 (if they wish to do so) and the Web Flow to team to work and test effectively in a JSF 2 environment.
|
||||
</para>
|
||||
</sect2>
|
||||
<sect2>
|
||||
<title>Portlet Version Changes</title>
|
||||
<para>
|
||||
Spring Web Flow 2.1 is built on Spring 3, which in turn requires Portlet API 2.0.
|
||||
There are no significant changes in Web Flow relating to this upgrade.
|
||||
The programming model for Spring Portlet MVC applications is mostly backwards compatible with applications running on Portlet API 1.0.
|
||||
The implications of this change are mostly with regards to runtime version requirements.
|
||||
</para>
|
||||
<para>
|
||||
The <code>booking-portlet-mvc</code> sample has been tested with Apache Pluto 2.0.1 with a nightly build update due to <ulink url="https://issues.apache.org/jira/browse/PLUTO-591">PLUTO-591</ulink>.
|
||||
Apache Pluto 2.0.2 or higher will give you that fix.
|
||||
</para>
|
||||
<para>
|
||||
The <code>booking-portlet-faces</code> sample unfortunately has not been tested successfully with the combination of JSF 1.2, Portlet 2.0, and Facelets.
|
||||
See the readme in the sample for more information.
|
||||
Bundled client resources (.js, .css, etc.)
|
||||
have been moved to <code>META-INF/web-resources</code> from their previous location
|
||||
under <code>META-INF</code>. This change is transparent for applications but will result
|
||||
in simpler and safer configuration when using the new resource handling
|
||||
mechanism available in Spring 3.0.4.
|
||||
</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
<sect1 id="whatsnew-spring3">
|
||||
<title>Spring 3 Changes</title>
|
||||
<sect1 id="whatsnew-jsf-portlet">
|
||||
<title>JFS Portlet Support</title>
|
||||
<sect2>
|
||||
<title>Spring EL</title>
|
||||
<title>Portlet API 2.0 and JSF 1.2 support</title>
|
||||
<para>
|
||||
The Spring Expression language is now the default implementation used in Spring Web Flow.
|
||||
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 <xref linkend="el"/>.
|
||||
In previous versions of Spring Web Flow support for JSF Portlets relied on
|
||||
a Portlet Bridge for JSF implementation and was considered experimental.
|
||||
Spring Web Flow 2.2 adds support for JSF Portlets based on its own internal
|
||||
Portlet integration targeting Portlet API 2.0 and JSF 1.2 environments.
|
||||
See <xref linkend="portlet-jsf"/> for more details.
|
||||
The Spring Web Flow Travel JSF Portlets sample has been successfully
|
||||
tested on the Apache Pluto portal container.
|
||||
</para>
|
||||
</sect2>
|
||||
<sect2>
|
||||
<title>Spring 3 Type Conversion</title>
|
||||
<para>
|
||||
Spring Web Flow now uses the new Spring 3 type conversion and formatting mechanism that includes use of formatting annotations such as <code>NumberFormat</code> and <code>DateTimeFormat</code>.
|
||||
The Spring 3 type conversion was influenced by the existing mechanism used in Spring Web Flow.
|
||||
Hence Web Flow users should find this to be a logical step forward.
|
||||
</para>
|
||||
<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 <xref linkend="view-type-conversion"/>.
|
||||
</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
<sect1 id="whatsnew-tiles">
|
||||
<title>Tiles Updates</title>
|
||||
<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>
|
||||
</sect1>
|
||||
</sect1>
|
||||
</chapter>
|
||||
|
||||
@@ -23,4 +23,9 @@
|
||||
<function-class>org.springframework.faces.security.FaceletsAuthorizeTagUtils</function-class>
|
||||
<function-signature>boolean areNotGranted(java.lang.String)</function-signature>
|
||||
</function>
|
||||
<function>
|
||||
<function-name>isAllowed</function-name>
|
||||
<function-class>org.springframework.faces.security.FaceletsAuthorizeTagUtils</function-class>
|
||||
<function-signature>boolean isAllowed(java.lang.String, java.lang.String)</function-signature>
|
||||
</function>
|
||||
</facelet-taglib>
|
||||
@@ -32,12 +32,11 @@
|
||||
|
||||
<!--
|
||||
Uncomment this to disable partial state saving when using Apache MyFaces 2 !!
|
||||
-->
|
||||
|
||||
<context-param>
|
||||
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
|
||||
<param-value>false</param-value>
|
||||
</context-param>
|
||||
-->
|
||||
|
||||
|
||||
<!-- Declare Spring Security Facelets tag library -->
|
||||
|
||||
@@ -32,20 +32,6 @@
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
|
||||
<!-- Serves static resource content from .jar files such as spring-js.jar -->
|
||||
<servlet>
|
||||
<servlet-name>Resources Servlet</servlet-name>
|
||||
<servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>
|
||||
<load-on-startup>0</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
<!-- Map all /resources requests to the Resource Servlet for handling -->
|
||||
<servlet-mapping>
|
||||
<servlet-name>Resources Servlet</servlet-name>
|
||||
<url-pattern>/resources/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
<!-- Generated Portlet Wrapper Servlet for Apache Pluto deployment -->
|
||||
<servlet>
|
||||
|
||||
Reference in New Issue
Block a user