我正在尝试在两个jsf页面之间传递变量。我已经搜索并尝试了一些来自互联网的解决方案,但我被卡住了。
在我的first_config.xml中有一个像这样的bean:
<managed-bean>
<managed-bean-name>configBean</managed-bean-name>
<managed-bean-class>
mypackage.ConfigBean
</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>domainName</property-name>
<value>Config</value>
</managed-property>
<managed-property>
<property-name>configService</property-name>
<value>#{configService}</value>
</managed-property>
</managed-bean>
在second_config.xml中,我注入了那个bean:
<managed-bean>
<managed-bean-name>accountSelfBean2</managed-bean-name>
<managed-bean-class>mypackage.AccountSelfBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>domainName</property-name>
<value>AccountSelf</value>
</managed-property>
<managed-property>
<property-name>configBean</property-name>
<value>#{configBean}</value>
</managed-property>
</managed-bean>
在AccountSelfBean.java类中,我已经有了get / set方法:
private ConfigBean configBean;
public ConfigBean getConfigBean() {
return configBean;
}
public void setConfigBean(ConfigBean configBean) {
this.configBean = configBean;
}
但是,当我尝试调试时,我发现我的configBean
是null
。