Page 1 of 7 123 ... LastLast
Results 1 to 10 of 62

Thread: RichFaces/Ajax4JSF integration now available

  1. #1
    Join Date
    Apr 2005
    Location
    San Francisco, CA
    Posts
    1,224

    Default 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. #2
    Join Date
    Mar 2008
    Posts
    21

    Default

    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)

  3. #3
    Join Date
    Mar 2008
    Posts
    21

    Default

    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

  4. #4
    Join Date
    Apr 2005
    Location
    San Francisco, CA
    Posts
    1,224

    Default

    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

  5. #5
    Join Date
    Mar 2008
    Posts
    21

    Default

    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

  6. #6
    Join Date
    Jul 2007
    Posts
    4

    Default 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

  7. #7
    Join Date
    Mar 2008
    Posts
    2

    Default 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)

  8. #8
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    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
    Keith Donald
    Core Spring Development Team

  9. #9
    Join Date
    Mar 2008
    Posts
    170

    Default

    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

  10. #10
    Join Date
    Apr 2005
    Location
    San Francisco, CA
    Posts
    1,224

    Default

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

    -Jeremy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •