在HttpSession中找不到CDI @Named @SessionScoped bean

问题描述

我有一个JSF2应用程序。

我已经使用CDI定义了一个会话bean。

import javax.enterprise.context.SessionScoped;
import javax.inject.Named;

@Named
@SessionScoped
public class UserBean implements Serializable
{
  private String userName = null;
  private String password = null;

  ... getters and setters ...
} 

是否可以从HttpSession获取bean?例如,当我尝试从Servlet类的HttpSession中获取它时,我会得到null

HttpSession session = request.getSession(false);
UserBean userBean = (UserBean) session.getAttribute("userBean");

谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)