On Wed, Apr 8, 2009 at 1:07 PM, Ken Paulsen
<Ken.Paulsen@sun.com> wrote:
While perhaps it can be simplified to a shorter name, or one that doesn't build off "compositeComponent", I feel strongly that all EL should be given the opportunity to be specified explicitly. For example: #{foo} vs. #{requestScope.foo} vs. #{sessionScope.foo}, vs. #{compositeComponent.attrs.foo}. So, not only is there a performance penalty for being a lazy developer and not being explicit (requiring a search of all scopes until found), but there is also a name-space problem. I also argue that it hurts readability of your code to not be explicit. I discourage all implicit EL references -- IMO, it's simply bad practice.
In general I agree with Ken. I have been able to measure considerable performance degradation from not qualifying any EL expression. However, in this particular case, Facelets always checks its own context first before it even delegates to an EL resolver (since it has control over the template and hence the initial EL lookup.
While the performance argument doesn't really apply here, there is another problem. The Facelets vars shadow all other EL attributes, so the more attributes you have the more likely that will happen. For instance, say you have an attribute named "view" and in the implementation you were trying to use the implicit object "view". Now you have a problem.
-Dan