【问题标题】:various ways to get session access object in struts2 other than implementing SessionAware interface除了实现 SessionAware 接口之外,在 struts2 中获取会话访问对象的各种方法
【发布时间】:2016-03-21 01:27:06
【问题描述】:

伙计们,我是 Struts2 的初学者。我正在尝试使用会话,但我无法通过实现 SessionAware 创建会话对象所以除了SessionAware 之外,还有其他方法可以创建会话对象吗提前谢谢 任何帮助将不胜感激

【问题讨论】:

    标签: java session struts2


    【解决方案1】:
    Map session = ActionContext.getContext().getSession();
    

    可以使用上述方法获取会话对象

    【讨论】:

    • Map session = (Map)ActionContext.getContext().getSession();需要转换。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多