atom feed39 messages in org.apache.myfaces.usersRe: best way to initialize BackingBean?
FromSent OnAttachments
Stefan GesigoraAug 31, 2005 1:53 am 
Martin MarinschekAug 31, 2005 2:12 am 
Stefan GesigoraAug 31, 2005 2:20 am 
Stefan GesigoraAug 31, 2005 3:38 am 
Enrique MedinaAug 31, 2005 3:43 am 
Guy KatzAug 31, 2005 3:53 am 
Stefan GesigoraAug 31, 2005 4:00 am 
MuraliAug 31, 2005 4:19 am 
MuraliAug 31, 2005 4:43 am 
Jeff CooperAug 31, 2005 5:13 am 
Sean SchofieldAug 31, 2005 5:34 am 
Werner PunzAug 31, 2005 5:37 am 
hicham abassiAug 31, 2005 6:21 am 
Sean SchofieldAug 31, 2005 6:23 am 
hicham abassiAug 31, 2005 6:29 am 
Sean SchofieldAug 31, 2005 6:30 am 
Gary VanMatreAug 31, 2005 7:59 am 
Mike KienenbergerAug 31, 2005 10:57 am 
Ken WeinerAug 31, 2005 10:59 am 
Mike KienenbergerAug 31, 2005 11:13 am 
Craig McClanahanAug 31, 2005 11:25 am 
Mike KienenbergerAug 31, 2005 11:39 am 
Denn...@ak.blm.govAug 31, 2005 11:51 am 
Ken WeinerAug 31, 2005 11:54 am 
Craig McClanahanAug 31, 2005 12:25 pm 
Mike KienenbergerAug 31, 2005 12:34 pm 
Craig McClanahanAug 31, 2005 12:40 pm 
Craig McClanahanAug 31, 2005 12:51 pm 
Mike KienenbergerAug 31, 2005 1:07 pm 
Martin MarinschekAug 31, 2005 1:47 pm 
Mike KienenbergerSep 1, 2005 8:01 am 
Martin MarinschekSep 1, 2005 8:43 am 
Mike KienenbergerSep 1, 2005 8:50 am 
Martin MarinschekSep 1, 2005 9:06 am 
Mike KienenbergerSep 1, 2005 9:21 am 
Martin MarinschekSep 1, 2005 9:54 am 
CONNER, BRENDAN (SBCSI)Sep 2, 2005 5:59 pm 
Craig McClanahanSep 2, 2005 9:25 pm 
hicham abassiSep 6, 2005 12:15 pm 
Subject:Re: best way to initialize BackingBean?
From:Martin Marinschek (mart@gmail.com)
Date:Aug 31, 2005 1:47:26 pm
List:org.apache.myfaces.users

Hint, hint taken ;)

MyFaces does that. It is in the appendix of the spec, and MyFaces (at least partially - as much as was needed of that by me) supports setting parameters onto Converters...

regards,

Martin

On 8/31/05, Craig McClanahan <crai@gmail.com> wrote:

On 8/31/05, Mike Kienenberger <mkie@gmail.com> wrote:

On 8/31/05, Craig McClanahan <crai@gmail.com> wrote:

If you are using by-Class converters, you don't need to register them on the *component* at all -- they get registered in the Application instance along with the class they are for. I'm not sure I see a need to use a DI framework to instantiate those, since you already have the ability to configure the implementation class that will be used.

Craig,

Can you expand on this? What do I need to do to gain the ability to configure the implementation class?

Simply include a registration for the converter in one of your faces-config.xml files. The following entry will override the standard converer that is applied to any property of type Integer:

<converter> <converter-for-class>java.lang.Integer</converter-for-class>

<converter-class>com.mycompany.MyIntegerConverter</converter-class> </converter>

Your config files are read *after* the JSF implementation has been configured, so this *replaces* the standard one.

I have lots of converters registered by class, and I want to DI a managed JSF bean into each of them. How do I do this?

In other words, you want to use DI for configuring properties on a by-class converter? That, sadly, isn't supported unless you were to override the Application instance provided by your JSF impementation (or if your JSF implementation provided this feature as part of its own implementation, hint hint :-). The technique I described doesn't reference any by-id or by-type registered converters ... it creates anonymous instances.

But you don't *need* to use DI for this if your MyIntegerConverter class (see previous example) is already set up exactly the way you want it after the public zero-args constructor returns. All you need for that is the registration described above.

Craig

--

http://www.irian.at Your JSF powerhouse - JSF Trainings in English and German