Date
1 - 3 of 3
JSF 2.3 Section 5.4.1 question regarding injection
pnicoluc@...
Hello,
According to the JSF spec section 5.4.1 “JSF Managed Classes and Java EE Annotations”, there are a bunch of JSF artifacts eligible for injection. On MyFaces, all these objects allow injection when they are registered globally via faces-config.xml. However, injection in ActionListener and PhaseListener don’t work if they are registered per component/view in a facelet using <f:actionListener/> and <f:phaseListener/>. The following MyFaces JIRA was opened to discuss the issue with the MyFaces community: https://issues.apache.org/jira/browse/MYFACES-4138 On Mojarra, I was not able to get these objects to support injection, I tried registering them globally via faces-config.xml and registering them per component/view in a facelet. Does injection in ActionListener or PhaseListener need to be supported when they are registered in a facelet using <f:actionListener/> and <f:phaseListener/>? Thanks, Paul Nicolucci |
|
PN> According to the JSF spec section 5.4.1 JSF Managed Classes and JavaOn Tue, 22 Aug 2017 07:18:25 -0700, pnicoluc@... said: PN> EE Annotations, there are a bunch of JSF artifacts eligible for PN> injection. PN> On MyFaces, all these objects allow injection when they are PN> registered globally via faces-config.xml. However, injection in PN> ActionListener and PhaseListener dont work if they are registered PN> per component/view in a facelet using <f:actionListener/> and PN> <f:phaseListener/>. PN> The following MyFaces JIRA was opened to discuss the issue with the PN> MyFaces community: PN> https://issues.apache.org/jira/browse/MYFACES-4138 PN> On Mojarra, I was not able to get these objects to support PN> injection, I tried registering them globally via faces-config.xml PN> and registering them per component/view in a facelet. PN> Does injection in ActionListener or PhaseListener need to be PN> supported when they are registered in a facelet using PN> <f:actionListener/> and <f:phaseListener/>? Hello Paul, Looking at 5.4.1, there is no specific exclusion for ActionListener or PhaseListener when they happen to be declared in a Facelet. Indeed, looking at the code for both tags, I see we simply are just using new. if (instance == null && type != null) { try { instance = (PhaseListener) ReflectionUtil.forName( this.type).newInstance(); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) I have opened <https://github.com/javaee/javaserverfaces-spec/issues/1449>: I propose we add to the errata an issue excluding these two from having to be injectable when they are created via a facelet. Ed -- | 23 business days until JavaOne 2017 | 103 business days until JavaLand 2018 | edward.burns@... | office: +1 407 458 0017 |
|
PN> Hello, According to the JSF spec section 5.4.1 JSF Managed ClassesOn Tue, 22 Aug 2017 07:18:25 -0700, pnicoluc@... said: PN> and Java EE Annotations, there are a bunch of JSF artifacts eligible PN> for injection. EB> First, let me introduce you to Ren Zhijun. Zhijun is taking over asOn Fri, 17 Nov 2017 05:23:29 -0800, Edward Burns <edward.burns@...> said: EB> maintenance lead of JSF for all versions of JSF 2.3 and earlier. EB> What happens with new JSRs after 2.3 is up to EE4J. PN> On MyFaces, all these objects allow injection when they are PN> registered globally via faces-config.xml. However, injection in PN> ActionListener and PhaseListener dont work if they are registered PN> per component/view in a facelet using <f:actionListener/> and PN> <f:phaseListener/>. PN> The following MyFaces JIRA was opened to discuss the issue with the PN> MyFaces community: PN> https://issues.apache.org/jira/browse/MYFACES-4138 PN> On Mojarra, I was not able to get these objects to support PN> injection, I tried registering them globally via faces-config.xml PN> and registering them per component/view in a facelet. PN> Does injection in ActionListener or PhaseListener need to be PN> supported when they are registered in a facelet using PN> <f:actionListener/> and <f:phaseListener/>? I think they should support injection, but I will leave that for Zhijun to decide. Thanks, Ed -- | 7 business days until CodeEurope Poland 2017 | 53 business days until JavaLand 2018 | edward.burns@... | office: +1 407 458 0017 |
|