Announcement Announcement Module
Collapse
No announcement yet.
RichFaces/Ajax4JSF integration now available Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • RichFaces/Ajax4JSF integration now available

    We have completed testing the use of RichFaces in combination with Spring Faces and some special integration support has been added and is available in the latest nightly snapshot of RC1.

    A couple of minor things had to be tweaked in order to allow RichFaces to work on its own with the Web Flow JSF integration. Additionally, we've added a special RichFacesAjaxHandler class that can be configured as a property on your FlowController that will allow the RichFaces components to be used alongside the Spring Faces components in the same page. This is especially useful as certain features such as the popup support are natively handled by the Spring Javascript library used by the Spring Faces components.

    Configuring the RichFacesAjaxHandler is simple:
    Code:
    <bean id="flowController" class="org.springframework.webflow.mvc.FlowController">
    	<constructor-arg ref="flowExecutor" />
    	<property name="ajaxHandler">
    		<bean class="org.springframework.faces.mvc.richfaces.RichFacesAjaxHandler"/>
    	</property>
    </bean>
    One nice part of the integration is that you can continue to use the <render> tag in your flow definition to control which components are re-rendered in response to an Ajax request. Doing so just requires binding the reRender attribute of your RichFaces Ajax component to a special flow variable called flowRenderFragments. For example the "More Results" command link in the reviewHotels view of the Spring Travel sample app becomes:

    Code:
    <a4j:commandLink id="nextPageLink" value="More Results" action="next" reRender="#{flowRenderFragments}" rendered="#{not empty hotels and hotels.rowCount == searchCriteria.pageSize}"/>
    So for those of you out there using RichFaces with Web Flow (especially those of you who were encountering problems), I encourage you to grab the latest nightly build of RC1 from the snapshots repo and give it a try and let us know if you encounter any further problems.

    - Jeremy

  • #2
    I have tested this example in the page "More Results" and an other simple example. But The ajax response/fragment is not rendered.

    (JSF 1.2 RI, facelet, richfaces - JBoss 4.2 - firefox 2.0)

    Comment


    • #3
      I join the war deployed in Jboss 4.2 with richfaces integration where the problem of rendering occurs. I have added in reviewHotels.xhtml the link
      "<a4j:commandLink id="nextPageLink" value="More Results" action="next" reRender="#{flowRenderFragments}" rendered="#{not empty hotels and hotels.rowCount == searchCriteria.pageSize}"/>".
      Spring webflow jar version is the last (rc1-20080316-393)

      swf-booking-faces.war

      Comment


      • #4
        You need to add a mapping for the RichFaces filter onto the Spring Dispatcher Servlet as follows (in web.xml):

        Code:
        <filter-mapping> 
            <filter-name>richfaces</filter-name> 
            <servlet-name>Spring Web MVC Dispatcher Servlet</servlet-name>
            <dispatcher>REQUEST</dispatcher>
            <dispatcher>FORWARD</dispatcher>
            <dispatcher>INCLUDE</dispatcher>
        </filter-mapping>
        -Jeremy

        Comment


        • #5
          Thank you for your answer, but the behavior is the same : fragment is not rendered when "More Results" link (with a4j:commandLink) is clicked (for example).

          Thanks in advance

          Comment


          • #6
            a4j reRender not working - flowRenderFragments are empty

            Hi,

            I have the same problem, as the
            Code:
            #{flowRenderFragments}
            are always empty, the reRender of the a4j:command button doesn't work, whats even more strange is, that even when I set the reRender attribute to the real id of the datatable it still doesn't work (only when reload is pressed)...

            Oh and btw if I use the facelets debugging tag on the page
            Code:
            <ui:debug hotkey="l" rendered="true"/>
            I get the following:
            Code:
            org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.webflow.execution.repository.BadlyFormattedFlowExecutionKeyException: Badly formatted flow execution key 'c3v2?facelets.ui.DebugOutput=1206265753407', the expected format is 'c<conversationId>v<continuationId>'
            	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:535)
            	org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:453)
            	javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
            	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
            	org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
            	org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
            	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:360)
            	org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
            	org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
            	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:372)
            	org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:113)
            	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:50)
            	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:372)
            	org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:115)
            	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:50)
            	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:372)
            	org.springframework.security.ui.rememberme.RememberMeProcessingFilter.doFilterHttp(RememberMeProcessingFilter.java:124)
            	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:50)
            	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:372)
            	org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
            	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:50)
            	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:372)
            	org.springframework.security.ui.basicauth.BasicProcessingFilter.doFilterHttp(BasicProcessingFilter.java:177)
            	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:50)
            	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:372)
            	org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:272)
            	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:50)
            	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:372)
            	org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:96)
            	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:50)
            	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:372)
            	org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:241)
            	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:50)
            	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:372)
            	org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:174)
            	org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:183)
            	org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:138)
            
            root cause
            
            org.springframework.webflow.execution.repository.BadlyFormattedFlowExecutionKeyException: Badly formatted flow execution key 'c3v2?facelets.ui.DebugOutput=1206265753407', the expected format is 'c<conversationId>v<continuationId>'
            	org.springframework.webflow.execution.repository.support.AbstractFlowExecutionRepository.parseContinuationId(AbstractFlowExecutionRepository.java:239)
            	org.springframework.webflow.execution.repository.support.AbstractFlowExecutionRepository.parseFlowExecutionKey(AbstractFlowExecutionRepository.java:116)
            	org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:127)
            	org.springframework.webflow.mvc.FlowController.handleRequestInternal(FlowController.java:129)
            	org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
            	org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
            	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:874)
            	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:808)
            	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:523)
            	org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:453)
            	javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
            	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
            	org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
            	org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
            	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:360)
            	org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
            	org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
            	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:372)
            	org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:113)
            	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:50)
            	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:372)
            	org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:115)
            	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:50)
            	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:372)
            	org.springframework.security.ui.rememberme.RememberMeProcessingFilter.doFilterHttp(RememberMeProcessingFilter.java:124)
            	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:50)
            	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:372)
            	org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
            	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:50)
            	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:372)
            	org.springframework.security.ui.basicauth.BasicProcessingFilter.doFilterHttp(BasicProcessingFilter.java:177)
            	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:50)
            	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:372)
            	org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:272)
            	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:50)
            	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:372)
            	org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:96)
            	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:50)
            	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:372)
            	org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:241)
            	org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:50)
            	org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:372)
            	org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:174)
            	org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:183)
            	org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:138)
            
            root cause
            
            java.lang.NumberFormatException: For input string: "2?facelets.ui.DebugOutput=1206265753407"
            	java.lang.NumberFormatException.forInputString(Unknown Source)
            	java.lang.Integer.parseInt(Unknown Source)
            	java.lang.Integer.valueOf(Unknown Source)
            Thx in advance,
            Mike

            Comment


            • #7
              rich Faces does not work (have to refresh to rerender)

              I've tried a simple example of Richfaces integration with SWF 2.0.
              The response seems to be correct but the problem is, that the fragment is not rerender immediatly. I have to refresh the page in order to see the ajax response into my page. :-(

              Is there something missing into the config of richfaces integration ?

              (We've tried with JSF RI and MyFaces)

              Comment


              • #8
                Ok, so obviously something is going on here. I assume you guys are all using the latest RC1 snapshots, and not M4 as the RichFaces integration is just available in the snapshots currently.

                I have reopened this issue for investigation and will also unsticky this thread until we know more about what is causing this problem.

                Keith

                Comment


                • #9
                  I have just downloaded 'SWF/spring-webflow-2.0.0.ci-410.zip' and still have the error that I have to manually refresh the page to see the updated page.

                  I'm currently testing Spring 2.5x, SWF 2, Toplink JPA, Myfaces, Richfaces and Facelets and in general I'm happy

                  Looking forward to the Richfaces fix.

                  Thanks for all your support!!!
                  - Peter

                  Comment


                  • #10
                    Those of you that are having problems, are you using the latest version of RichFaces? (3.1.4GA, as I recall.)

                    -Jeremy

                    Comment


                    • #11
                      Originally posted by jeremyg484 View Post
                      Those of you that are having problems, are you using the latest version of RichFaces? (3.1.4GA, as I recall.)

                      -Jeremy
                      Yes
                      - Peter

                      Comment


                      • #12
                        Originally posted by jeremyg484 View Post
                        Those of you that are having problems, are you using the latest version of RichFaces? (3.1.4GA, as I recall.)

                        -Jeremy
                        Yes, it's the Richfaces 3.1.4GA with Facelets 1.1.14 and JSF RI (or MyFaces)

                        Comment


                        • #13
                          After testing more RichFaces components I would like to share some information regarding the update problem.

                          I looks to me that on the server side everything goes fine, the only difference I have seen so far in the log is how actions are invoked:

                          Myfaces:
                          Code:
                          DEBUG: org.springframework.faces.webflow.FlowActionListener - Invoking action javax.faces.component._MethodExpressionToMethodBinding@b6c3b9
                          RichFaces :
                          Code:
                          DEBUG: org.springframework.faces.webflow.FlowActionListener - Invoking action com.sun.facelets.el.LegacyMethodBinding@db440a
                          The fact that after a manual refresh everything looks fine supports the assumption that everything goes fine on the server side.

                          On the client side I have seen that different scripts are invoked to perform the update of the DOM.

                          Myfaces:
                          dojo.js

                          Myfaces URL:
                          Code:
                          http://localhost:8080/BD/spring/enter-metadata-admin-flow?execution=c2v2
                          RichFaces script:
                          a4j_3_1_4.GAorg.ajax4jsf.javascript.AjaxScript

                          RichFaces URL:
                          Code:
                          http://localhost:8080/BD/spring/enter-metadata-admin-flow?execution=c2v1&javax.portlet.faces.DirectLink=true
                          I guess for some reason the RichFaces Ajax script does not trigger the refresh correctly.

                          I have installed FireBug to view the requestes and the DOM. In case somebody can recommend a more appropriate tool to view DOM changes (I do not find a search funtion in this one) please share a link

                          - Peter
                          Last edited by iwtolall; Mar 28th, 2008, 04:25 AM. Reason: URLs added

                          Comment


                          • #14
                            Btw. this thread should not debar somebody from using RichFaces and SWF together. I'm playing around since a week and (for me) everything works fine except the re-rendering of fragments does not work (I currently use the reRender feature of RichFaces).

                            - Peter

                            Comment


                            • #15
                              All,

                              I am still having trouble reproducing the issues reported in this thread. In order to help things along, I have attached my RichFaces version of the booking sample to the corresponding JIRA issue:

                              http://jira.springframework.org/browse/SWF-462

                              This sample includes a maven pom with Jetty configuration so all you should have to do to test it out is 'mvn jetty:run' and point your browser to http://localhost:7001/swf-booking-richfaces/ It is set up to run against last night's build of the webflow artifacts.

                              One thing to note in the sample that I failed to point out before is that to get things working correctly, I had to use the <a4j: outputPanel> tag in place of where we use the Facelets <ui:fragment> tag in the standard sample.

                              If those of you that are having trouble could take a moment to compare my version of the sample with what you are trying to do locally and help me isolate any issues by reproducing them in the sample, that would be a fantastic help.

                              Thanks again for all the feedback!

                              Comment

                              Working...
                              X