How to change value of a session bean from a request bean?
I have a session bean FooSessionBean
which has a boolean property: visible
.
I want to change the value of the visible
property from my FooRequestBean. Is there any way to do this, other than ch开发者_Python百科anging the scope of FooRequestBean to session instead of request (to be able to inject FooSessionBean
into my FooRequestBean
)?
Thanks in advance.
Ps: I'm using JSF 1.2
Create a FooSessionBean
property (getter/setter) in FooRequestBean
and inject it using the faces-config.xml
:
<managed-bean>
<managed-bean-name>fooRequestBeanName</managed-bean-name>
<managed-bean-class>foo.FooRequestBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>fooSessionBeanPropName</property-name>
<property-class>foo.FooSessionBean</property-class>
<value>#{sessionScope.fooSessionBeanName}</value>
</managed-property>
//etc
精彩评论