From 8f9ad87fc834b1db23741b5e5c814b11fb2e138f Mon Sep 17 00:00:00 2001 From: Jeremy Grelle Date: Tue, 13 May 2008 22:18:49 +0000 Subject: [PATCH] Added instructions for third-party component library integration (including RichFaces and Trinidad). --- spring-webflow-reference/src/spring-faces.xml | 193 ++++++++++++++++-- 1 file changed, 176 insertions(+), 17 deletions(-) diff --git a/spring-webflow-reference/src/spring-faces.xml b/spring-webflow-reference/src/spring-faces.xml index 683707a9..4e601840 100644 --- a/spring-webflow-reference/src/spring-faces.xml +++ b/spring-webflow-reference/src/spring-faces.xml @@ -129,11 +129,16 @@ ]]> - - Configuring Web Flow to render JSF views - - The next step is to configure Web Flow to render JSF views. To do this, in your Spring Web Flow configuration include the faces namespace and link in the faces flow-builder-services: - + + Configuring Web Flow to render JSF views + + The next step is to configure Web Flow to render JSF views. To do this, in your Spring Web Flow + configuration include the + faces + namespace and link in the faces + flow-builder-services + : + ]]> - - See the booking-faces reference application in the distribution for a complete working example. - - + See the booking-faces reference application in the distribution for a complete working example. + Configuring faces-config.xml @@ -558,8 +561,8 @@ JSF and Web Flow combine to provide and extensive server-side validation model for your web application, but excessive roundtrips to the server to execute this validation and return error messages can be a tedious experience for your users. Spring Faces provides a number of client-side rich validation controls that can - enhance the user experience by applying simple validations that give immediate feedback. Some simple - examples are illustrated below. See the Spring Faces taglib docs for a complete tag reference. + enhance the user experience by applying simple validations that give immediate feedback. Some simple + examples are illustrated below. See the Spring Faces taglib docs for a complete tag reference. Validating a Text Field @@ -620,19 +623,175 @@ - Preventing an Invalid Form Submission - The validateAllOnClick component can be used to intercept the "onclick" event of a child - component and suppress the event if all client-side validations do not pass. - Preventing an Invalid Form Submission + + The + validateAllOnClick + component can be used to intercept the "onclick" event of a child component and suppress the event if + all client-side validations do not pass. + +   ]]> - This will prevent the form from being submitted when the user clicks the "proceed" button if the form - is invalid. When the validations are executed, the user is given clear and immediate indicators of the + This will prevent the form from being submitted when the user clicks the "proceed" button if the form is + invalid. When the validations are executed, the user is given clear and immediate indicators of the problems that need to be corrected. + + Third-Party Component Library Integration + + Spring Faces strives to be compatible with any third-party JSF component library. By honoring all of the + standard semantics of the JSF specification within the SWF-driven JSF lifecycle, third-party libraries in + general should "just work". The main thing to remember is that configuration in web.xml will change slightly + since Spring Faces requests are not routed through the standard FacesServlet. Typically, anything that is + traditionally mapped to the FacesServlet should be mapped to the Spring DispatcherServlet instead. (You can + also map to both if for example you are migrating a legacy JSF application page-by-page.) In some cases, a + deeper level of integration can be achieved by configuring special flow services that are "aware" of a + particular component library, and these will be noted in the examples to follow. + + + Rich Faces Integration + + To use the Rich Faces component library with Spring Faces, the following filter configuration is needed + in web.xml (in addition to the typical Spring Faces configuration): + + + RichFaces Filter + richfaces + org.ajax4jsf.Filter + + + + richfaces + Spring Web MVC Dispatcher Servlet + REQUEST + FORWARD + INCLUDE +]]> + + + For deeper integration (including the ability to have a view with combined use of the Spring Faces Ajax + components and Rich Faces Ajax components), configure the RichFacesAjaxHandler on your FlowController: + + + + + + +]]> + + + RichFaces Ajax components can be used in conjunction with the + render + tag to render partial fragments on an Ajax request. Instead of embedding the ids of the components to be + re-rendered directly in the view template (as you traditionally do with Rich Faces), you can bind the + reRender + attribute of a RichFaces Ajax component to a special + flowRenderFragments + EL variable. For example, in your view template you can have a fragment that you would potentially like + to re-render in response to a particular event: + + + + + + + Name + #{hotel.name} + + + Address + #{hotel.address} + + + +]]> + + + then a RichFaces Ajax + commandLink + to fire the event: + + ]]> + + + and then in your flow definition a + transition + to handle the event: + + + + +]]> + + + + Apache MyFaces Trinidad Integration + + The Apache MyFaces Trinidad library has been tested with the Spring Faces integration and proven to fit + in nicely. Deeper integration to allow the Trinidad components and Spring Faces components to play + well together has not yet been attempted, but Trinidad provides a pretty thorough solution on its own + when used in conjunction with the Spring Faces integration layer. + + + Typical Trinidad + Spring Faces configuration is as follows in web.xml (in addition to the typical + Spring Faces configuration): + + + javax.faces.STATE_SAVING_METHOD + server + + + + + org.apache.myfaces.trinidad.CHANGE_PERSISTENCE + + session + + + + + org.apache.myfaces.trinidad.ENABLE_QUIRKS_MODE + + false + + + + Trinidad Filter + + org.apache.myfaces.trinidad.webapp.TrinidadFilter + + + + + Trinidad Filter + Spring MVC Dispatcher Servlet + + + + Trinidad Resource Servlet + + org.apache.myfaces.trinidad.webapp.ResourceServlet + + + + + resources + /adf/* + +]]> + + +