On Mon, May 25, 2009 at 1:39 AM, Jim Driscoll <Jim.Driscoll@sun.com> wrote:
On 5/24/09 8:39 PM, David Geary wrote:
And that id is *exactly* what <f:ajax> says it cannot find. It's in the
page, but <f:ajax> cannot find it?!?

My guess is that <f:ajax> is evaluating the id before the page is
completely constructed, and therefore, it doesn't find it, but that's
just a WAG on my part.

So, if this is not correct:

<f:ajax render="#{cc.parent.clientId}:image"/>

Then how do I access the image in the parent (map) component?

It seems to me that I'm using <f:ajax> correctly, but I'd be happy to be
told otherwise.

It's late, but yes, that looks correct, and yes, your guess sounds correct.  Could you file this as an impl bug?

Now, we do need to fix that as a bug, but I must argue that your use case represents bad practice.  Your component is using ajax inside a component to modify the using page.  That's difficult to maintain, and I suspect it will lead to obfuscated code quite easily.  I'd instead argue that if you are going to have one component modify another, you should either group them into one composite, or, have the ID of the component you act upon passed in as an attribute (say "for="?)

Very good point. You should definitely be parametrizing the id anyway.

Of course, that second usage suggestion opens up another hole in the cc api - the lack of ability to do name resolution.  Though if/when we get method parameters, then cc.findComponent will work, I guess.    Though I've been saying that for a pretty long time now, I should check on when we're getting those method params...

Apparently in Java EE 6 under the auspices of JSP 2 MR1. We should check with the Java EE 6 EG on this one.


Dan Allen
Senior Software Engineer, Red Hat | Author of Seam in Action


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.