Re: Bean definition question faces-config.xml
If you use the jsf-spring integration library, you can use spring beans from JSF. Maybe this solves your problems? regards, Martin On 12/7/05, Kurt Edegger [EMAIL PROTECTED] wrote: Thank you for your fast response! on 12/6/2005 7:39 PM Simon Kitching stated: [...snip...] This is definitely not a feature of the JSF specification, and MyFaces can't add any new tags to the faces-config.xml file without violating the spec. Ok, short and precise answer ;) [...snip...] You can also do initialisation after all the properties have been set. See the FAQ entry How do I know when a managed bean's properties have all been set?. There's a method called initDao() in the class org.springframework.jdbc.core.support.JdbcDaoSupport which should be overwritten in a case you need to init a DAO (which is the case in my situation). But this one is not called by JSF right? So I'd need to use spring to construct the bean? Thank you for pointing to the FAQ - missed that one .. Take care, Kurt http://wiki.apache.org/myfaces/FAQ Or is possible to use/reference Spring beans in faces-config.xml? Any managed-property like: managed-property namefoo/name value#{someValue}/value /managed-property simply looks for a key someValue in the request, session and application scopes. So if your spring bean is stored in one of those maps then it will be passed to the managed bean on creation. Regards, Simon -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces
Re: Bean definition question faces-config.xml
Hi. I wonder if it is possible to declare the constructor of a bean in faces-config.xml similar to using constructor-arg in spring's configuration files. The idea behind this is, that I'd like to inject a bean into my application and use a referenced bean already in the constructor. As far as I know and encountered, first the default constructor is called, then the referenced beans are injected by using the corresponding setters, and finally the bean is used in the application depending of the scope. Or is possible to use/reference Spring beans in faces-config.xml? Of course you can use/reference Spring beans in faces-config.xml. Just use Spring's variable resolver. variable-resolverorg.springframework.web.jsf.DelegatingVariableResolver/variable-resolver If you want to declare your bean in Spring context but make it available as a managed bean (for instance, to define bean scoping), use proxies. Bye. /lexi
Re: Bean definition question faces-config.xml
Kurt Edegger wrote: Hi, I wonder if it is possible to declare the constructor of a bean in faces-config.xml similar to using constructor-arg in spring's configuration files. This is definitely not a feature of the JSF specification, and MyFaces can't add any new tags to the faces-config.xml file without violating the spec. The idea behind this is, that I'd like to inject a bean into my application and use a referenced bean already in the constructor. As far as I know and encountered, first the default constructor is called, then the referenced beans are injected by using the corresponding setters, and finally the bean is used in the application depending of the scope. There's no way to set anything in the constructor AFAIK. The constructor could manually look up the desired object, though: see the FAQ entry How can I access one Managed Bean from another?. You can also do initialisation after all the properties have been set. See the FAQ entry How do I know when a managed bean's properties have all been set?. http://wiki.apache.org/myfaces/FAQ Or is possible to use/reference Spring beans in faces-config.xml? Any managed-property like: managed-property namefoo/name value#{someValue}/value /managed-property simply looks for a key someValue in the request, session and application scopes. So if your spring bean is stored in one of those maps then it will be passed to the managed bean on creation. Regards, Simon
Re: Bean definition question faces-config.xml
Faces doesn't do constructor injection :( Original message Date: Tue, 06 Dec 2005 18:55:01 -0800 From: Kurt Edegger [EMAIL PROTECTED] Subject: Bean definition question faces-config.xml To: MyFaces Discussion users@myfaces.apache.org Hi, I wonder if it is possible to declare the constructor of a bean in faces-config.xml similar to using constructor-arg in spring's configuration files. The idea behind this is, that I'd like to inject a bean into my application and use a referenced bean already in the constructor. As far as I know and encountered, first the default constructor is called, then the referenced beans are injected by using the corresponding setters, and finally the bean is used in the application depending of the scope. Or is possible to use/reference Spring beans in faces- config.xml? Thank you for your answers, Kurt Dennis Byrne
Re: Bean definition question faces-config.xml
Thank you for your fast response! on 12/6/2005 7:39 PM Simon Kitching stated: [...snip...] This is definitely not a feature of the JSF specification, and MyFaces can't add any new tags to the faces-config.xml file without violating the spec. Ok, short and precise answer ;) [...snip...] You can also do initialisation after all the properties have been set. See the FAQ entry How do I know when a managed bean's properties have all been set?. There's a method called initDao() in the class org.springframework.jdbc.core.support.JdbcDaoSupport which should be overwritten in a case you need to init a DAO (which is the case in my situation). But this one is not called by JSF right? So I'd need to use spring to construct the bean? Thank you for pointing to the FAQ - missed that one .. Take care, Kurt http://wiki.apache.org/myfaces/FAQ Or is possible to use/reference Spring beans in faces-config.xml? Any managed-property like: managed-property namefoo/name value#{someValue}/value /managed-property simply looks for a key someValue in the request, session and application scopes. So if your spring bean is stored in one of those maps then it will be passed to the managed bean on creation. Regards, Simon