Spring Webflow-如何在评估表达式中传递会话? [英] Spring webflow - how to pass the session in evaluate expression?

查看:94
本文介绍了Spring Webflow-如何在评估表达式中传递会话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用spring webflow,但是我需要使用通过过渡==>评估表达式访问的方法来访问HttpSession. (因此在包含我的流程的xml文件中) 到目前为止,我还没有找到一种将其实际传递给我的方法的方法.我看了flowrequest上下文,但到目前为止我还没有找到方法.

I'm using spring webflow, but I need to access my HttpSession in a method that's accessed using a transition ==> evaluate expression. (so in the xml file containing my flow) So far I've yet to find a way to actually pass it to my method. I've taken a look at the flowrequestcontext but so far I haven't found a way yet.

推荐答案

我认为您无需在通过RequestContext后立即通过它.您可以尝试以下方法:

I think you don't need to pass it as soon as you pass the RequestContext. You can try this:

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

这篇关于Spring Webflow-如何在评估表达式中传递会话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆