我最近開始升級一些應用程序以使用Spring Webflow 2,並且我想利用Webflow 2附帶的新Ajax功能。有人可以請我指導一個教程將Tiles 2與Spring Webflow整合在一起(因爲這顯然是他們推薦的)。我發現Webflow 2在這方面的文檔絕對沒用。集成Spring Webflow 2和Apache Tiles
回答
這就是我所做的得到它與一個Webflow 2個工作和瓷磚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>
這不完全指的是Ajax特性,但它幫助我獲得Apache磚2建立定期流動:
http://jee-bpel-soa.blogspot.com/2008/12/spring-web-flows-2-and-tiles.html
多很多細節的鏈接,但核心你需要位是一種新的視圖解析器:
<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>
非常感謝您的回覆,但不幸的是,它並沒有比SWF 2提供的文檔更有用。我確實最終得到了它的工作,儘管我真的必須進行深入研究並且玩弄很多東西來找出那些沒有的東西不要在SWF 2文檔中說。如果有人想要SWF2的幫助,他們是非常歡迎與我聯繫alexmarshall132 gmail dot com – 2009-06-01 05:58:20
我一定有興趣知道你必須做什麼才能讓它直接在視圖狀態下呈現圖塊定義。目前,我只是渲染了只有
它在文檔中有完美的解釋。所以,請不要說不是。
如何在春季用磚:10.5查看分辨率(鏈接+#彈簧MVC-配置彈簧視圖分辨率)
如何使用Ajax與春季瓷磚:11.5:處理Ajax請求(鏈接+#彈簧JS-AJAX)
複製代碼從這些鏈接,你將最終的東西是這樣的:
的配置的Webflow使用瓷磚:
<!-- 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>
配置爲瓷磚:
<!-- 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>
配置爲瓷磚+阿賈克斯:
<!--
- 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>
- 1. Spring 3 MVC和Apache Tiles 2集成錯誤
- 2. Spring MVC3 + Apache tiles + Thymeleaf集成問題
- 3. Spring MVC&Tiles集成
- 4. Spring MVC 4 + Apache Tiles 2 + Thymeleaf 3的集成錯誤
- 5. Spring WebFlow 2和Apache Tiles 3配置。第二個視圖不起作用。
- 6. 如何集成Spring Webflow,Spring Mobile和WURFL
- 7. Spring MVC + Tiles:集成測試
- 8. Spring 3.1 ReloadableResourceBundleMessageSource和Apache Tiles 2.2.2
- 9. Apache Tiles與JSP和Servlet集成webapp
- 10. Spring MVC與Tiles的集成
- 11. Velocity vs Apache Tiles
- 12. Spring 4 MVC + Apache Tiles 3 + JQuery
- 13. Spring MVC和Apache Tiles移植到AngularJS/Backbone
- 14. Spring MVC和Apache Tiles:404問題
- 15. Spring MVC和Apache Tiles - 404錯誤
- 16. Spring MVC 3和Apache Tiles 2,但沒有控制器
- 17. Spring和Struts 2的集成
- 18. JSF 2和Spring集成3
- 19. 與Spring Webflow的
- 20. Struts 2與Tiles問題集成
- 21. Spring Webflow和JQuery
- 22. JUnit和Spring Webflow
- 23. 從Sitemesh遷移到Apache Tiles
- 24. Spring Webflow 2和可加書籤的URL
- 25. 集成Spring MVC Apache的瓷磚和Hibernate
- 26. Apache Kafka與tomcat和spring的集成
- 27. Spring集成 - Apache ActiveMQ到Kafka
- 28. Spring Webflow和primefaces ActionListners
- 29. Spring 4 + Apache Tiles 3顯示純文本
- 30. NoClassDefFoundError:org/apache/tiles/TilesApplicationContext Spring Servlet發生錯誤
所以,沒有工作? – 2009-05-16 16:36:56