| From | Sent On | Attachments |
|---|---|---|
| Dhananjay Prasanna | Jun 21, 2006 7:03 pm | |
| Ondrej Svetlik | Jun 21, 2006 7:36 pm | |
| Dhananjay Prasanna | Jun 21, 2006 7:43 pm | |
| Rick | Jun 21, 2006 8:02 pm | |
| Craig McClanahan | Jun 21, 2006 8:58 pm | |
| Dhananjay Prasanna | Jun 21, 2006 9:06 pm | |
| Craig McClanahan | Jun 21, 2006 9:32 pm | |
| Rick | Jun 22, 2006 7:24 am | |
| Surapuraju, Vamsi | Jun 22, 2006 10:41 am | |
| Cosma Colanicchia | Jun 23, 2006 2:21 am | |
| Bill Schneider | Jun 23, 2006 8:16 am | |
| Dhananjay Prasanna | Jun 25, 2006 4:41 pm | |
| Craig McClanahan | Jun 25, 2006 5:15 pm | |
| Dhananjay Prasanna | Jun 25, 2006 5:49 pm | |
| Craig McClanahan | Jun 25, 2006 6:43 pm | |
| Dhananjay Prasanna | Jun 25, 2006 6:56 pm |
| Subject: | Re: managed properties | |
|---|---|---|
| From: | Craig McClanahan (crai...@apache.org) | |
| Date: | Jun 21, 2006 8:58:48 pm | |
| List: | org.apache.myfaces.users | |
On 6/21/06, Rick <rick...@arc-mind.com> wrote:
<managed-bean> <managed-bean-name>businessDelegate</managed-bean-name> <managed-bean-class>com.delegates.BusinessDelegate</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> </managed-bean>
<managed-bean> <managed-bean-name>manageMyBean</managed-bean-name> <managed-bean-class>com.beans.ManageMyBean</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> <managed-property> <property-name>businessDelegate</property-name> <value>#{requestScope.businessDelegate}</value> </managed-property> </managed-bean>
The above injects businessDelegate into manageMyBean. It also creates a new instance if it is needed.
Actually, you're working too hard. Just use:
<value>#{businessDelegate}</value>
JSF IoC container is not that powerful, I prefer to use Spring and then use
the Spring delegating variable resolver.
You could also write your own JSF variable resolver and then manage the businessDelegate w/o putting it into scope.
You can accomplish that with standard managed beans my setting the <managed-bean-scope> on the "businessDelegate" bean to be "none". This is like the create-every-time mode of Spring ... you always get a new instance each time the expression is evaluated, and it is never placed into any scope.
Craig





