Re: JSF 2.3 Section 5.4.1 question regarding injection
PN> According to the JSF spec section 5.4.1 JSF Managed Classes and JavaOn Tue, 22 Aug 2017 07:18:25 -0700, pnicoluc@us.ibm.com 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@oracle.com | office: +1 407 458 0017
|
|