jsr344-experts@javaserverfaces-spec-public.java.net

[jsr344-experts] Referencing composite component attributes in child components outside of a tree traversal

From: Kito Mann <kito.mann_at_virtua.com>
Date: Wed, 17 Aug 2011 20:17:36 -0400

Hello everyone,

I just ran into an issue where #{cc.attrs.property} expressions don't work
when referenced via properties of child components if they're not referenced
inside of a tree traversal. More information here:
https://issues.apache.org/jira/browse/MYFACES-3283 (happens in both MyFaces
and Mojarra).

Section 5.6.2.1 (Implicit Object ELResolver for Facelets and Programmatic
Access) of the spec states the following:

cc -> the current composite component relative to
the declaring page in which the expression appears.

Since "current composite component" usually means the current composite
being processed during a tree traversal, "cc" can return null when it's
referenced elsewhere (i.e. in an action listener);.

I'm thinking that the "cc" implicit variable should return the parent
composite component in cases where no "current composite component" is
available.

Thoughts?
---
Kito D. Mann | twitter: kito99 | Author, JSF in Action
Virtua, Inc. | http://www.virtua.com | JSF/Java EE training and consulting
http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info | twitter:
jsfcentral
+1 203-404-4848 x3
* Listen to the latest headlines in the JSF and Java EE newscast:
http://blogs.jsfcentral.com/roller/editorsdesk/category/JSF+and+Java+EE+Newscast
* Keep up with the aftermath of the Oracle/Sun merger:
http://www.mergerspeak.com