[jsr-314-open] Ajax rendering of components among compositions?

Jim Driscoll Jim.Driscoll at SUN.COM
Mon May 25 01:39:56 EDT 2009


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="?)

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...

Jim




More information about the jsr-314-open-mirror mailing list