如何在FlowScope中获得变量?

Mao*_*Mao 2 spring-webflow

在我的Spring Web流程中,我有一个FlowScope名为"action" 的变量,我想在验证方法中检查这个变量;

\\\\\\
    if(action=="copy"){
    doCopy;
    }else{
    doOther;
    } 
\\\\\\\
Run Code Online (Sandbox Code Playgroud)

但我不知道如何调用"动作"变量.请帮我.

小智 5

你不能这样访问它:

RequestContext rc = RequestContextHolder.getRequestContext();
String action = (String) rc.getFlowScope().get("action");
Run Code Online (Sandbox Code Playgroud)

或者,如果你知道类型,没有类型转换:

String action = rc.getFlowScope().getString("action");
Run Code Online (Sandbox Code Playgroud)