Spring webflow - 每次刷新时调用方法(请求)

时间:2012-03-01 13:58:47

标签: spring-webflow

如何在每次刷新时调用bean-action方法? 我把它放在渲染动作中,但它没有帮助:

    <render-actions>
       <bean-action bean="personService" method="getPerson">
        <method-arguments>
            <argument
                    expression="flowScope.personId"
                    parameter-type="java.lang.Long" />
        </method-arguments>
        <method-result name="person" scope="flow" />
       </bean-action>
    </render-actions>

1 个答案:

答案 0 :(得分:0)

答案:需要添加“redirect:”来查看view-state中的param,所以在这种情况下,render-actions将在每次刷新(request)时执行,所以完整的代码是:

<view-state id="browsePersonForm" view="redirect:personInfo">
    <render-actions>
       <bean-action bean="personService" method="getPerson">
        <method-arguments>
            <argument
                    expression="flowScope.personId"
                    parameter-type="java.lang.Long" />
        </method-arguments>
        <method-result name="person" scope="request" />
       </bean-action>
    </render-actions>
</view-state>