开发者

How to change value of a session bean from a request bean?

开发者 https://www.devze.com 2023-03-06 07:46 出处:网络
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开发者

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
0

精彩评论

暂无评论...
验证码 换一张
取 消