# 附录 A.流定义语言 1.0 到 2.0 的映射

自 1.0 版本发布以来，流定义语言已经发生了变化。这是 1.0 版本中的语言元素的列表，以及它们如何映射到 2.0 版本中的元素。虽然大多数变化是语义上的，但也有一些结构上的变化。有关 Web Flow1.0 和 2.0 之间的更改的更多详细信息，请参见升级指南。



**表 A.1.映射**

|      SWF 1.0       |       SWF 2.0       |评论|                        |                                                                          |
|--------------------|---------------------|--------------------------------------------------------------------------|------------------------|--------------------------------------------------------------------------|
|      *action*      |        *\**         |使用 \<evaluate /\>|                        |                                                                          |
|                    |        bean         |                                                                          |           \*           |                                                                          |
|                    |        name         |                                                                          |           \*           |                                                                          |
|                    |       method        |                                                                          |           \*           |                                                                          |
|   *action-state*   |   *action-state*    |                                                                          |                        |                                                                          |
|                    |         id          |                                                                          |           id           |                                                                          |
|                    |         \*          |                                                                          |         parent         |                                                                          |
|     *argument*     |        *\**         |使用 \<evaluate expression="func(arg1, arg2, ...)"/\>|                        |                                                                          |
|                    |     expression      |                                                                          |                        |                                                                          |
|                    |   parameter-type    |                                                                          |                        |                                                                          |
|    *attribute*     |     *attribute*     |                                                                          |                        |                                                                          |
|                    |        name         |                                                                          |          name          |                                                                          |
|                    |        type         |                                                                          |          type          |                                                                          |
|                    |        value        |                                                                          |         value          |                                                                          |
| *attribute-mapper* |        *\**         |输入和输出元素可以直接在流或子流中|                        |                                                                          |
|                    |        bean         |                                                                          |           \*           |         now subflow-attribute-mapper attribute on subflow-state          |
|   *bean-action*    |        *\**         |使用 \<evaluate /\>|                        |                                                                          |
|                    |        bean         |                                                                          |           \*           |                                                                          |
|                    |        name         |                                                                          |           \*           |                                                                          |
|                    |       method        |                                                                          |           \*           |                                                                          |
|  *decision-state*  |  *decision-state*   |                                                                          |                        |                                                                          |
|                    |         id          |                                                                          |           id           |                                                                          |
|                    |         \*          |                                                                          |         parent         |                                                                          |
|   *end-actions*    |      *on-end*       |                                                                          |                        |                                                                          |
|    *end-state*     |     *end-state*     |                                                                          |                        |                                                                          |
|                    |         id          |                                                                          |           id           |                                                                          |
|                    |        view         |                                                                          |          view          |                                                                          |
|                    |         \*          |                                                                          |         parent         |                                                                          |
|                    |         \*          |                                                                          |         commit         |                                                                          |
|  *entry-actions*   |     *on-entry*      |                                                                          |                        |                                                                          |
| *evaluate-action*  |     *evaluate*      |                                                                          |                        |                                                                          |
|                    |     expression      |                                                                          |       expression       |                                                                          |
|                    |        name         |                                                                          |           \*           |use \<evaluate ...\> \<attribute name=”name” value="..." /\> \</evaluate\>|
|                    |         \*          |                                                                          |         result         |                                                                          |
|                    |         \*          |                                                                          |      result-type       |                                                                          |
|*evaluation-result* |        *\**         |使用 \<evaluate result="..." /\>|                        |                                                                          |
|                    |        name         |                                                                          |           \*           |                                                                          |
|                    |        scope        |                                                                          |           \*           |                                                                          |
|*exception-handler* | *exception-handler* |                                                                          |                        |                                                                          |
|                    |        bean         |                                                                          |          bean          |                                                                          |
|   *exit-actions*   |      *on-exit*      |                                                                          |                        |                                                                          |
|       *flow*       |       *flow*        |                                                                          |                        |                                                                          |
|                    |         \*          |                                                                          |      start-state       |                                                                          |
|                    |         \*          |                                                                          |         parent         |                                                                          |
|                    |         \*          |                                                                          |        abstract        |                                                                          |
|*global-transitions*|*global-transitions* |                                                                          |                        |                                                                          |
|        *if*        |        *if*         |                                                                          |                        |                                                                          |
|                    |        test         |                                                                          |          test          |                                                                          |
|                    |        then         |                                                                          |          then          |                                                                          |
|                    |        else         |                                                                          |          else          |                                                                          |
|      *import*      |    *bean-import*    |                                                                          |                        |                                                                          |
|                    |      resource       |                                                                          |        resource        |                                                                          |
|   *inline-flow*    |        *\**         |转换到新的顶级流|                        |                                                                          |
|                    |         id          |                                                                          |           \*           |                                                                          |
| *input-attribute*  |       *input*       |                                                                          |                        |                                                                          |
|                    |        name         |                                                                          |          name          |                                                                          |
|                    |        scope        |                                                                          |           \*           |         prefix name with scope \<input name="flowScope.foo" /\>          |
|                    |      required       |                                                                          |        required        |                                                                          |
|                    |         \*          |                                                                          |          type          |                                                                          |
|                    |         \*          |                                                                          |         value          |                                                                          |
|   *input-mapper*   |        *\**         |输入可以是流，也可以是子流。|                        |                                                                          |
|     *mapping*      |  *input or output*  |                                                                          |                        |                                                                          |
|                    |       source        |                                                                          |     name or value      |      name when in flow element, value when in subflow-state element      |
|                    |       target        |                                                                          |     name or value      |      value when in flow element, name when in subflow-state element      |
|                    |  target-collection  |                                                                          |           \*           |                           no longer supported                            |
|                    |        from         |                                                                          |           \*           |                          detected automatically                          |
|                    |         to          |                                                                          |          type          |                                                                          |
|                    |      required       |                                                                          |        required        |                                                                          |
| *method-argument*  |        *\**         |使用 \<evaluate expression="func(arg1, arg2, ...)"/\>|                        |                                                                          |
|  *method-result*   |        *\**         |使用 \<evaluate result="..." /\>|                        |                                                                          |
|                    |        name         |                                                                          |           \*           |                                                                          |
|                    |        scope        |                                                                          |           \*           |                                                                          |
| *output-attribute* |      *output*       |                                                                          |                        |                                                                          |
|                    |        name         |                                                                          |          name          |                                                                          |
|                    |        scope        |                                                                          |           \*           |         prefix name with scope \<output name="flowScope.foo" /\>         |
|                    |      required       |                                                                          |        required        |                                                                          |
|                    |         \*          |                                                                          |          type          |                                                                          |
|                    |         \*          |                                                                          |         value          |                                                                          |
|  *output-mapper*   |        *\**         |输出可以是流，也可以是子流。|                        |                                                                          |
|  *render-actions*  |     *on-render*     |                                                                          |                        |                                                                          |
|       *set*        |        *set*        |                                                                          |                        |                                                                          |
|                    |      attribute      |                                                                          |          name          |                                                                          |
|                    |        scope        |                                                                          |           \*           |          prefix name with scope \<set name="flowScope.foo" /\>           |
|                    |        value        |                                                                          |         value          |                                                                          |
|                    |        name         |                                                                          |           \*           |     use \<set ...\> \<attribute name=”name” value="..." /\> \</set\>     |
|                    |         \*          |                                                                          |          type          |                                                                          |
|  *start-actions*   |     *on-start*      |                                                                          |                        |                                                                          |
|   *start-state*    |        *\**         |现在 \<flow start-state="..."\>，或者默认为流中的第一个状态|                        |                                                                          |
|                    |        idref        |                                                                          |           \*           |                                                                          |
|  *subflow-state*   |   *subflow-state*   |                                                                          |                        |                                                                          |
|                    |         id          |                                                                          |           id           |                                                                          |
|                    |        flow         |                                                                          |        subflow         |                                                                          |
|                    |         \*          |                                                                          |         parent         |                                                                          |
|                    |         \*          |                                                                          |subflow-attribute-mapper|                                                                          |
|    *transition*    |    *transition*     |                                                                          |                        |                                                                          |
|                    |         on          |                                                                          |           on           |                                                                          |
|                    |    on-exception     |                                                                          |      on-exception      |                                                                          |
|                    |         to          |                                                                          |           to           |                                                                          |
|                    |         \*          |                                                                          |          bind          |                                                                          |
|                    |         \*          |                                                                          |        validate        |                                                                          |
|                    |         \*          |                                                                          |        history         |                                                                          |
|      *value*       |       *value*       |                                                                          |                        |                                                                          |
|       *var*        |        *var*        |                                                                          |                        |                                                                          |
|                    |        name         |                                                                          |          name          |                                                                          |
|                    |        class        |                                                                          |         class          |                                                                          |
|                    |        scope        |                                                                          |           \*           |                            always flow scope                             |
|                    |        bean         |                                                                          |           \*           |                 all Spring beans can be resolved with EL                 |
|    *view-state*    |    *view-state*     |                                                                          |                        |                                                                          |
|                    |         id          |                                                                          |           id           |                                                                          |
|                    |        view         |                                                                          |          view          |                                                                          |
|                    |         \*          |                                                                          |         parent         |                                                                          |
|                    |         \*          |                                                                          |        redirect        |                                                                          |
|                    |         \*          |                                                                          |         popup          |                                                                          |
|                    |         \*          |                                                                          |         model          |                                                                          |
|                    |         \*          |                                                                          |        history         |                                                                          |
|        *\**        |*persistence-context*|                                                                          |                        |                                                                          |
|        *\**        |      *render*       |                                                                          |                        |                                                                          |
|                    |         \*          |                                                                          |       fragments        |                                                                          |
|        *\**        |      *secured*      |                                                                          |                        |                                                                          |
|                    |         \*          |                                                                          |       attributes       |                                                                          |
|                    |         \*          |                                                                          |         match          |                                                                          |
