Spring Web Flow 1.0 RC4 釋出

釋出 | Keith Donald | 2006 年 10 月 5 日 | ...
親愛的 Spring 社群成員:
 
我們很高興宣佈 Spring Web Flow 1.0 RC4 已釋出。
 

 

Spring Web Flow 是 Spring 社群的一個產品,專注於協調 Web 應用程式中的使用者介面流程。

此版本包含許多改進和幾個令人興奮的新功能。  我們認為它是迄今為止最穩定的版本,並且最終,此版本使 Spring Web Flow 1.0 最終路線圖的功能已完成。  Spring Web Flow 1.0 最終版將在下週釋出,改動最小。  從現在到那時,我們鼓勵您測試 1.0 RC4,以便在 1.0 正式釋出之前幫助發現任何剩餘問題。

請注意,此版本中存在影響使用者的更改。  1.0 RC3 或更早版本的使用者應查閱 升級指南,其中詳細概述了這些更改。

1.0 RC4 中的新增和重要特性列表令人興奮,包括: 

新增和重要特性

作為 Spring Web Flow 1.0 最終版之前的最後一個釋出候選版本,Spring Web Flow 1.0 RC4 引入了強大的新功能,例如渲染操作 (1)、評估操作 (2)、設定操作 (3)、快閃記憶體範圍 (4)、流程執行屬性 (5) 和暫停時始終重定向 (6)。它提供了增強的文件、更好的流程定義驗證、智慧預設值以及用於配置流程執行引擎的完整自定義 Spring 2.0 配置模式 (7)。

  • (1) 渲染操作在響應被渲染之前執行應用程式行為。  當請求檢視狀態進行可渲染檢視選擇時,或者在重定向或瀏覽器重新整理按鈕觸發的重新整理時,會呼叫渲染操作。  以下示例展示了一個在渲染結果檢視之前執行電話簿搜尋的渲染操作。

    <view-state id="displayResults" view="searchResults">
        <render-actions>
            <bean-action bean="phonebook" method="search">
                <method-arguments>
                    <argument expression="flowScope.searchCriteria"/>          
                </method-arguments>
                    <method-result name="results"/>
            </bean-action>
        </render-actions>
        <transition on="newSearch" to="enterCriteria"/>
        <transition on="select" to="browseDetails"/>
    </view-state>

  • (2) 評估操作根據流程執行狀態評估表示式。  表示式(預設為基於 OGNL)可以針對流程執行的根 RequestContext 可訪問的任何物件,包括任何範圍(例如流程範圍)中的物件。  以下示例展示了一個評估操作,它在“game”流程範圍 bean 上呼叫“makeGuess”方法
    <action-state id="makeGuess">
        <evaluate-action expression="flowScope.game.makeGuess(requestParameters.guess)">
            <evaluation-result name="guessResult"/>
        </evaluate-action>
        <transition on="CORRECT" to="showAnswer"/>
        <transition on="*" to="enterGuess"/>
        <transition on-exception="java.lang.NumberFormatException" to="enterGuess"/>
    </action-state>
  • (3) 設定操作設定範圍型別(例如流程範圍)中的屬性值。  屬性可以是頂級屬性,也可以是巢狀屬性路徑上的屬性。  以下示例展示了一個設定操作,它將“fileUploaded”屬性在快閃記憶體範圍中設定為“true”。
    <action-state id="uploadFile">
        <action bean="uploadAction" method="uploadFile"/>
        <transition on="success" to="selectFile">
            <set attribute="fileUploaded" scope="flash" value="true"/>
        </transition>
    </action-state>
  • (4) 快閃記憶體範圍是一種新的範圍型別,用於在重定向和檢視的任何重新整理之間持久化屬性。  當發出事件訊號以退出檢視時,快閃記憶體範圍將被清除。  以下完整的流程定義示例展示瞭如何使用快閃記憶體範圍將“fileUploaded”屬性暴露給 selectFile 檢視狀態,以便在成功上傳後顯示成功訊息。
    <flow xmlns="http://www.springframework.org/schema/webflow"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://www.springframework.org/schema/webflow
                                           http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd">
   
        <start-state idref="selectFile"/>
       
        <view-state id="selectFile" view="fileForm">
            <transition on="submit" to="uploadFile"/>
        </view-state>
   
        <action-state id="uploadFile">
            <action bean="uploadAction" method="uploadFile"/>
            <transition on="success" to="selectFile">
                <set attribute="fileUploaded" scope="flash" value="true"/>
            </transition>
        </action-state>
       
    </flow>
  • (5) 流程執行屬性允許您設定自定義屬性,這些屬性可以影響流程執行行為。  以下示例顯示了在 Portlet 環境中(重定向通常不適用)將“alwaysRedirectOnPause”屬性設定為 false 的指令。
    <flow:executor id="flowExecutor" registry-ref="flowRegistry">
        <flow:execution-attributes>
            <flow:alwaysRedirectOnPause value="false"/>
        </flow:execution-attributes>
    </flow:executor>
  • (6) “暫停時始終重定向”為您提供預設的 POST+REDIRECT+GET 行為,無需特殊編碼。 現在預設情況下,當進入檢視狀態時,會自動發出重定向。  這會觸發對流程執行 URL 的重新整理,該 URL 在會話處於活動狀態時保持穩定。
  • (7) 新的 Spring 2.0 配置方言極大地簡化了系統配置,並提供了強大的驗證和工具支援。  現在配置 webflow 的基礎設施就像定義兩個元素一樣簡單,如下面的完整示例所示
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:flow="http://www.springframework.org/schema/webflow-config"
           xsi:schemaLocation="
               http://www.springframework.org/schema/beans
               http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
               http://www.springframework.org/schema/webflow-config
               http://www.springframework.org/schema/webflow-config/spring-webflow-config-1.0.xsd">
   
        <!-- Launches new flow executions and resumes existing executions. -->   
        <flow:executor id="flowExecutor" registry-ref="flowRegistry"/>
       
        <!-- Creates the registry of flow definitions for this application -->
        <flow:registry id="flowRegistry">
            <flow:location path="/WEB-INF/flows/**-flow.xml"/>
        </flow:registry>
       
    </beans>

有關這些功能的更多資訊,請參閱參考手冊。  Spring Web Flow 1.0 RC4 進一步完善了參考文件,提供了 70 頁關於 SWF 使用的說明。  該手冊可線上獲取,格式為 HTMLPDF

入門指南

學習 Spring Web Flow 的最佳方法之一是檢視和演練示例應用程式。  我們建議從一開始就檢視所有示例,並根據需要補充參考手冊材料。該版本附帶了十個示例應用程式,每個應用程式都演示了一組獨特的產品功能。  這些示例是

  1. Phonebook - 演示了大多數功能(包括子流程)的原始示例
  2. Sellitem - 演示了一個帶有條件轉換、流程執行重定向、自定義文字欄位格式和續流的嚮導
  3. Flowlauncher - 演示了啟動和恢復流程的所有可能方式
  4. Itemlist - 演示了 REST 風格的 URL 和內聯流程
  5. Shippingrate - 演示了 Spring Web Flow 與 Ajax 技術的結合
  6. NumberGuess - 演示了有狀態 Bean、評估操作和“單鍵”流程執行重定向。
  7. Birthdate - 演示了 Struts 整合
  8. Fileupload - 演示了多分部檔案上傳、設定操作和快閃記憶體範圍
  9. Phonebook-Portlet - Portlet 環境中的電話簿示例(請注意流程定義如何沒有改變)
  10. Sellitem-JSF - JSF 環境中的 sellitem 示例

要快速評估並構建示例應用程式,只需

  1. 解壓 spring-webflow-1.0-rc4.zip 釋出存檔
  2. 進入 projects/spring-webflow/build-spring-webflow 目錄
  3. 執行 "ant dist" 目標。
  4. 請參閱“target/artifacts”目錄,其中包含每個示例的可部署 .war 檔案以及已解壓的 war 目錄。
請參閱 release readme.txt 和 projects/spring-webflow/spring-webflow-samples/readme.txt,分別獲取有關釋出存檔內容和示例的更多資訊。

所有示例專案都是 Spring IDE 專案,可以直接匯入 Eclipse。

感謝所有支援此版本的朋友們。  Spring Web Flow 1.0 終於... 就在眼前了。

祝您使用愉快!

Spring Web Flow 團隊

訂閱 Spring 新聞通訊

透過 Spring 新聞通訊保持聯絡

訂閱

領先一步

VMware 提供培訓和認證,助您快速進步。

瞭解更多

獲取支援

Tanzu Spring 在一個簡單的訂閱中提供對 OpenJDK™、Spring 和 Apache Tomcat® 的支援和二進位制檔案。

瞭解更多

即將舉行的活動

檢視 Spring 社群所有即將舉行的活動。

檢視全部