Spring webflow - 如何在evaluate表达式中传递会话?

Jac*_*els 3 spring-webflow spring-webflow-2

我正在使用spring webflow,但是我需要在一个使用transition ==> evaluate表达式访问的方法中访问我的HttpSession.(所以在包含我的流的xml文件中)到目前为止,我还没有找到一种方法将它实际传递给我的方法.我已经看了一下flowrequestcontext,但到目前为止我还没有找到方法.

vli*_*ios 8

我认为您不需要在传递RequestContext后立即传递它.你可以试试这个:

public class MyAction extends MultiAction{      
    public Event myMethod(RequestContext context){
        HttpSession session = ((HttpServletRequest)context.getExternalContext().getNativeRequest()).getSession();
        ...
    }
}
Run Code Online (Sandbox Code Playgroud)


小智 5

将对象(例如从 flowScope)插入到会话中,这对我有用:

<evaluate expression="externalContext.sessionMap.put('attributeName', flowScope.myObject)"/>
Run Code Online (Sandbox Code Playgroud)