我试图访问托管bean构造函数中的会话bean数据。为此,我使用下面的@ManagedProperty
注释。当我尝试访问构造函数时,它会给出java.lang.NullPointerException
,并且可以在另一个函数中访问同一段代码。可能是我需要为构造函数做一些不同的事情。有人能指导我需要做什么吗?在JSF托管bean的构造函数中访问会话bean数据
@ManagedProperty(value="#{sessionBean}")
private SelectCriteriaBean sessionData;
// This is contructor
public ModifyBusinessProcessBean() {
logger.debug(getSessionData().getSelectedBusinessProcessLevelZero());
}
// Another Function where the same code doesn't give error
public anotherFunction() {
logger.debug(getSessionData().getSelectedBusinessProcessLevelZero());
}
哈!行动中的并发:) – skuntsel 2013-03-15 08:51:46
是的,那真的是。 :) – partlov 2013-03-15 08:53:13
+1输入速度:) – skuntsel 2013-03-15 08:55:18