Hi David -
Yeah, as Dan says, the ajax tag needs to use the actual rendered id.
And so yes, as soon as you put it in a composite component, you need to
qualify the id with the cc.clientId. I've got no idea why the absolute
id doesn't work - except that it's quite possible that the absolute id
changed between generations of the page.
I've pointed you there before, but look at jsf-demo/ajax-switchlist for
an example that puts an ajax tag inside a composite component. I'm
going to crawl through that whole example in my JSF BOF at JavaOne this
year with Ryan.
See jsf-demo/basic-ajax-edit for an example that puts jsf.ajax.request
calls into a separate javascript file, and then puts that in a composite
component as well.
Jim
On 5/24/09 4:50 PM, David Geary wrote:
2009/5/24 Dan Allen <dan.j.allen(a)gmail.com
<mailto:dan.j.allen@gmail.com>>
All I've done is cut the zoom prompt and menu from the original
file, and pasted it into zoomLevelControl.xhtml.
However, now when I change the zoom level menu, I get an error:
<f:ajax> contains an unknown id 'image'
According to the AjaxBehaviorRenderer:
/**
* Attempt to find the component assuming the ID is relative to the
* nearest naming container. If not found, then search for the
component
* using an absolute component expression.
*/
My guess is that the components within the composite component are
considered to be within a naming container, isolating them from your
image component. The strange part, though, is that the composite
component is not acting like a naming container as I observed. To
fix your problem w/ the current implementation, you have to use an
absolute id to the image component (I would guess). But yeah, this
is a very confusing situation for developers.
Even that doesn't seem to work. I loaded the page and copied the
absolute id, like this:
<f:ajax
render="form:j_id1186681689_16ef8569:0:j_id1186681689_16ef8513:j_id-1105909415_41ead6fe:image"/>
And I receive this ugliness for my trouble:
<f:ajax> contains an unknown id
'form:j_id1186681689_16ef8569:0:j_id1186681689_16ef8513:j_id-1105909415_41ead6fe:image'
Frankly, for JSF 2.1, I would like to see us go to an XPath-like
syntax (or jQuery) to find components because component IDs in JSF
just plain suck.
Yup, I agree wholeheartedly, but we need to make it easy to do Ajax
rendering across composite components for JSF 2.0. IMO, composite
components are by far the single most kickass feature of JSF 2, and if
they're crippled, we're gonna get some bad press.
david
-Dan
--
Dan Allen
Senior Software Engineer, Red Hat | Author of Seam in Action
http://mojavelinux.com
http://mojavelinux.com/seaminaction
http://in.relation.to/Bloggers/Dan
NOTE: While I make a strong effort to keep up with my email on a daily
basis, personal or other work matters can sometimes keep me away
from my email. If you contact me, but don't hear back for more than
a week,
it is very likely that I am excessively backlogged or the message was
caught in the spam filters. Please don't hesitate to resend a
message if
you feel that it did not reach my attention.