Printing log from flow.xml

前端 未结 1 1727
刺人心
刺人心 2020-12-21 21:26

I am working on a web application with spring web flow. While I am working on a flow.xml file I have get a decision state on it like this -

&l         


        
相关标签:
1条回答
  • 2020-12-21 22:23

    You can add an on-exit tag to the end of the 'decision-state' and call any service methods, spring beans, or static methods on the classpath.

    Try this (untested):

    <decision-state id="checkPermissin">    
        <if test="requestParameters.canApprove" then="approve" else="warning" />
       <on-exit>
            <evaluate expression="T(org.apache.log4j.Logger).getLogger('someLogger').info(requestParameters.canApprove)"/>
       </on-exit>
    </decision-state>
    

    The above solution is more of a hack to fulfill what you are asking for. The "proper" way to log this is to extend a FlowExecutionListenerAdapter and to listen for your current flow + decision-state id "checkPermissin" then log whatever you desire about that flow but it would involve more setup/coding outside the flow.xml file. (see: Catch "dead" session in Spring webflow: the example is for catching exceptions but can easily be adapted for logging anything in a flow)

    0 讨论(0)
提交回复
热议问题