Spring Webflow 2 and Apache Tiles integration

I recently started updating some applications to use Spring Webflow 2, and I want to use the new Ajax functionality that comes with Webflow 2. Can someone please direct me to a tutorial on integrating Tiles 2 with Spring Webflow (since apparently they recommend). I found the documentation that comes with Webflow 2 in this regard is completely useless.

+6
spring spring-webflow tiles tiles2
source share
3 answers

This is what I did to make it work with webflow 2 and slabs 2.0

<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer"> <property name="definitions"> <list> <value>/WEB-INF/tiles-defs/templates.xml</value> </list> </property> </bean> <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="mappings"> <props> <prop key="/flow/**/*.html"> flowController </prop> <prop key="/**/*.html">viewController</prop> </props> </property> <property name="order" value="1" /> </bean> <bean id="tilesViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView" /> </bean> <bean id="flowController" class="org.springframework.webflow.mvc.servlet.FlowController"> <property name="flowExecutor" ref="flowExecutor" /> </bean> <webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry" /> <webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices" base-path="/WEB-INF/flow/user"> <webflow:flow-location path="/manage-users.xml" /> </webflow:flow-registry> <webflow:flow-builder-services id="flowBuilderServices" view-factory-creator="viewFactoryCreator" /> <bean id="viewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator"> <property name="viewResolvers" ref="tilesViewResolver" /> </bean> 
+2
source share

This doesn't quite apply to ajax functions, but it helped me configure apache 2 slabs for regular threads:

http://jee-bpel-soa.blogspot.com/2008/12/spring-web-flows-2-and-tiles.html

See the link for more information, but you need a kernel bit - a new look:

 <bean id="tilesViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView" /> </bean> <bean class="org.springframework.web.servlet.view.tiles2.TilesConfigurer"> <property name="definitions" value="/WEB-INF/flows/main/main-tiles.xml" /> </bean> 
+3
source share

This is perfectly explained in the docs. Therefore, please stop saying that this is not so.

http://static.springsource.org/spring-webflow/docs/2.0.x/reference/htmlsingle/spring-webflow-reference.html

How to use tiles in spring: 10.5 Allow viewing (link + # spring -mvc-config- spring -view-resolution)

How to use Ajax with tiles in spring: 11.5: Processing an Ajax request (link + # spring -js-ajax)

Copy the code from these links and you will get something like this:

Web Stream Configuration for Using Tiles:

  <!-- Plugs in a custom creator for Web Flow views --> <webflow:flow-builder-services id="flowBuilderServices" view-factory-creator="mvcViewFactoryCreator" /> <!-- Configures Web Flow to use Tiles to create views for rendering; Tiles allows for applying consistent layouts to your views --> <bean id="mvcViewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator"> <property name="viewResolvers" ref="tilesViewResolver" /> </bean> 

Tile configuration:

  <!-- Configures the Tiles layout system --> <bean class="org.springframework.web.servlet.view.tiles2.TilesConfigurer"> <property name="definitions"> <list> <value>/WEB-INF/views/layouts/page.xml</value> <value>/WEB-INF/views/layouts/table.xml</value> <value>/WEB-INF/views/globalViews.xml</value> <value>/WEB-INF/views/userViews.xml</value> </list> </property> </bean> 

Configuration for tiles + Ajax:

  <!-- - This bean configures the UrlBasedViewResolver, which resolves logical view names - by delegating to the Tiles layout system. A view name to resolve is treated as - the name of a tiles definition. --> <bean id="tilesViewResolver" class="org.springframework.js.ajax.AjaxUrlBasedViewResolver"> <property name="viewClass" value="org.springframework.webflow.mvc.view.FlowAjaxTilesView" /> </bean> 
+2
source share

All Articles