You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Ganesh <ga...@j4fry.org> on 2009/05/25 21:55:32 UTC

[Fwd: Re: Ajax rendering of components among compositions?]

Hi,

We'll have to include this with the logic of the f:ajax tag.

Best Regards,
Ganesh

-------- Original-Nachricht --------
Betreff: 	Re: Ajax rendering of components among compositions?
Datum: 	Mon, 25 May 2009 08:06:08 -0400
Von: 	Andy Schwartz <an...@ORACLE.COM>
Antwort an: 	JSR 314 Open Mailing list <JS...@JCP.ORG>
An: 	JSR-314-OPEN@JCP.ORG



Gang -

There is one obviously critical piece of information missing here that 
clearly needs to be described more explicitly within the spec/pdldocs. 
The format for the execute/render ids in the f:ajax tag matches the 
format for ids that are passed to findComponent(). That is... ids that 
do not start with the naming container separator character are treated 
as relative to the current naming container. Ids that do start with the 
separator character are treated as absolute ids - ie. are resolved 
relative to the UIViewRoot.

So, for example, let's say we have the following component tree where we 
use f:subview to introduce a naming contianer

<f:view>
<f:subview id="namingContainer">
<h:commandButton id="insideButton"/>
<h:graphicImage id="insideImage"/>
</f:subview>

<h:graphicImage id="outsideImage"/>

</f:view>

If we want to Ajax-enable the "insideButton" to target the "insideImage, 
we would use the following f:ajax tag:

<f:ajax render="insideImage"/>

If, on the other hand, we want to target the "outerImage", which is 
outside of the naming container, then we must use an "absolute id", eg:

<f:ajax render=":outsideImage"/>

(Note the leading ":" character.) This is similar to calling 
insideButtonComponent.findComponent(":outsideImage") - ie. this will 
start the search for the "outsideImage" id up at the root naming container.

The fact that the pdldocs do not describe the format for execute/render 
ids is clearly a spec bug that needs to be addressed. I will open a bug 
to track this in a moment. This behavior is defined in the actual spec 
document itself in section 10.4.1.1 under the title 'Specifying 
“execute”/”render” Identifiers'. But even that section could use some 
clarification (eg. could use an example like the one above to illustrate 
the behavior).


David Geary wrote On 5/24/2009 11:39 PM ET:
> Notice the <f:ajax> tag. I think I'm accessing the image from the 
> parent component (map.xhtml) correctly. However, when I load the page 
> I get this:
>
> <f:ajax> contains an unknown id
> 'form:j_id1186681689_16ef8569:0:j_id1186681689_16ef8513:j_id-1105909415_41ead6fe:image'

If I had to guess (haven't looked at the implementation yet), the issue 
is that we are searching for this id relative to the composite 
component's naming container. Since this particular id is not present 
under the composite component, we do not find the target component. We 
should make this error message more explicit - ie. we should include the 
id of the naming container within which we searched for the id.

>
> If I remove the f:ajax tag, load the page, and check the source, I see 
> an <img> tag:
>
> <img 
> id="form:j_id1186681689_16ef8569:0:j_id1186681689_16ef8513:j_id-1105909415_41ead6fe:image" 
> src="..."/>
>
> 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.

You'll need to use the ":" prefix within your render id to indicate that 
you are specifying an absolute id. If that does not work, then my guess 
is that there is an implementation bug here.

Andy



Re: [Fwd: Re: Ajax rendering of components among compositions?]

Posted by Ganesh <ga...@j4fry.org>.
Hi,

Andy has logged a spec issue on this. He thinks absolute ids should be 
prepended by a colon and wants to add this to the spec:

https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=567

We can comment the issue there.

Best regards,
Ganesh

Alexander Bell schrieb:
> I thought we don't have to use the leading colon. If JSF cannot find 
> "outsideImage" it has to search the component in the next higher 
> naming container (so f:view). I would use the leading colon when I've 
> got the same ID for two components in tow different naming containers. 
> In this situation the ID's are different so it makes it much more 
> complicated with the leading colon. IMO, if the ID is unique on the 
> page the "single" ID (without the leading colon) in the render 
> attribute would be appropriate otherwise an exception is thrown (and 
> then you have to use the leading colon).
>
>
>
> 2009/5/25 Ganesh <ganesh@j4fry.org <ma...@j4fry.org>>
>
>     Hi,
>
>     We'll have to include this with the logic of the f:ajax tag.
>
>     Best Regards,
>     Ganesh
>
>     -------- Original-Nachricht --------
>     Betreff:        Re: Ajax rendering of components among compositions?
>     Datum:  Mon, 25 May 2009 08:06:08 -0400
>     Von:    Andy Schwartz <andy.schwartz@ORACLE.COM
>     <ma...@ORACLE.COM>>
>     Antwort an:     JSR 314 Open Mailing list <JSR-314-OPEN@JCP.ORG
>     <ma...@JCP.ORG>>
>     An:     JSR-314-OPEN@JCP.ORG <ma...@JCP.ORG>
>
>
>
>     Gang -
>
>     There is one obviously critical piece of information missing here
>     that clearly needs to be described more explicitly within the
>     spec/pdldocs. The format for the execute/render ids in the f:ajax
>     tag matches the format for ids that are passed to findComponent().
>     That is... ids that do not start with the naming container
>     separator character are treated as relative to the current naming
>     container. Ids that do start with the separator character are
>     treated as absolute ids - ie. are resolved relative to the UIViewRoot.
>
>     So, for example, let's say we have the following component tree
>     where we use f:subview to introduce a naming contianer
>
>     <f:view>
>     <f:subview id="namingContainer">
>     <h:commandButton id="insideButton"/>
>     <h:graphicImage id="insideImage"/>
>     </f:subview>
>
>     <h:graphicImage id="outsideImage"/>
>
>     </f:view>
>
>     If we want to Ajax-enable the "insideButton" to target the
>     "insideImage, we would use the following f:ajax tag:
>
>     <f:ajax render="insideImage"/>
>
>     If, on the other hand, we want to target the "outerImage", which
>     is outside of the naming container, then we must use an "absolute
>     id", eg:
>
>     <f:ajax render=":outsideImage"/>
>
>     (Note the leading ":" character.) This is similar to calling
>     insideButtonComponent.findComponent(":outsideImage") - ie. this
>     will start the search for the "outsideImage" id up at the root
>     naming container.
>
>     The fact that the pdldocs do not describe the format for
>     execute/render ids is clearly a spec bug that needs to be
>     addressed. I will open a bug to track this in a moment. This
>     behavior is defined in the actual spec document itself in section
>     10.4.1.1 under the title 'Specifying “execute”/”render”
>     Identifiers'. But even that section could use some clarification
>     (eg. could use an example like the one above to illustrate the
>     behavior).
>
>
>     David Geary wrote On 5/24/2009 11:39 PM ET:
>
>         Notice the <f:ajax> tag. I think I'm accessing the image from
>         the parent component (map.xhtml) correctly. However, when I
>         load the page I get this:
>
>         <f:ajax> contains an unknown id
>         'form:j_id1186681689_16ef8569:0:j_id1186681689_16ef8513:j_id-1105909415_41ead6fe:image'
>
>
>     If I had to guess (haven't looked at the implementation yet), the
>     issue is that we are searching for this id relative to the
>     composite component's naming container. Since this particular id
>     is not present under the composite component, we do not find the
>     target component. We should make this error message more explicit
>     - ie. we should include the id of the naming container within
>     which we searched for the id.
>
>
>         If I remove the f:ajax tag, load the page, and check the
>         source, I see an <img> tag:
>
>         <img
>         id="form:j_id1186681689_16ef8569:0:j_id1186681689_16ef8513:j_id-1105909415_41ead6fe:image"
>         src="..."/>
>
>         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.
>
>
>     You'll need to use the ":" prefix within your render id to
>     indicate that you are specifying an absolute id. If that does not
>     work, then my guess is that there is an implementation bug here.
>
>     Andy
>
>
>
>
>
> -- 
> Mit freundlichen Grüßen / Kind regards
> Alexander Bell
>
> J4Fry OpenSource Community
> Internet: http://www.j4fry.org
> E-Mail: Alexander.Bell@j4fry.org <ma...@j4fry.org>
> Webprofil: http://www.j4fry.org/alexanderbell.shtml
>

Re: [Fwd: Re: Ajax rendering of components among compositions?]

Posted by Alexander Bell <Al...@j4fry.org>.
I thought we don't have to use the leading colon. If JSF cannot find
"outsideImage" it has to search the component in the next higher naming
container (so f:view). I would use the leading colon when I've got the same
ID for two components in tow different naming containers. In this situation
the ID's are different so it makes it much more complicated with the leading
colon. IMO, if the ID is unique on the page the "single" ID (without the
leading colon) in the render attribute would be appropriate otherwise an
exception is thrown (and then you have to use the leading colon).



2009/5/25 Ganesh <ga...@j4fry.org>

> Hi,
>
> We'll have to include this with the logic of the f:ajax tag.
>
> Best Regards,
> Ganesh
>
> -------- Original-Nachricht --------
> Betreff:        Re: Ajax rendering of components among compositions?
> Datum:  Mon, 25 May 2009 08:06:08 -0400
> Von:    Andy Schwartz <an...@ORACLE.COM>
> Antwort an:     JSR 314 Open Mailing list <JS...@JCP.ORG>
> An:     JSR-314-OPEN@JCP.ORG
>
>
>
> Gang -
>
> There is one obviously critical piece of information missing here that
> clearly needs to be described more explicitly within the spec/pdldocs. The
> format for the execute/render ids in the f:ajax tag matches the format for
> ids that are passed to findComponent(). That is... ids that do not start
> with the naming container separator character are treated as relative to the
> current naming container. Ids that do start with the separator character are
> treated as absolute ids - ie. are resolved relative to the UIViewRoot.
>
> So, for example, let's say we have the following component tree where we
> use f:subview to introduce a naming contianer
>
> <f:view>
> <f:subview id="namingContainer">
> <h:commandButton id="insideButton"/>
> <h:graphicImage id="insideImage"/>
> </f:subview>
>
> <h:graphicImage id="outsideImage"/>
>
> </f:view>
>
> If we want to Ajax-enable the "insideButton" to target the "insideImage, we
> would use the following f:ajax tag:
>
> <f:ajax render="insideImage"/>
>
> If, on the other hand, we want to target the "outerImage", which is outside
> of the naming container, then we must use an "absolute id", eg:
>
> <f:ajax render=":outsideImage"/>
>
> (Note the leading ":" character.) This is similar to calling
> insideButtonComponent.findComponent(":outsideImage") - ie. this will start
> the search for the "outsideImage" id up at the root naming container.
>
> The fact that the pdldocs do not describe the format for execute/render ids
> is clearly a spec bug that needs to be addressed. I will open a bug to track
> this in a moment. This behavior is defined in the actual spec document
> itself in section 10.4.1.1 under the title 'Specifying “execute”/”render”
> Identifiers'. But even that section could use some clarification (eg. could
> use an example like the one above to illustrate the behavior).
>
>
> David Geary wrote On 5/24/2009 11:39 PM ET:
>
>> Notice the <f:ajax> tag. I think I'm accessing the image from the parent
>> component (map.xhtml) correctly. However, when I load the page I get this:
>>
>> <f:ajax> contains an unknown id
>>
>> 'form:j_id1186681689_16ef8569:0:j_id1186681689_16ef8513:j_id-1105909415_41ead6fe:image'
>>
>
> If I had to guess (haven't looked at the implementation yet), the issue is
> that we are searching for this id relative to the composite component's
> naming container. Since this particular id is not present under the
> composite component, we do not find the target component. We should make
> this error message more explicit - ie. we should include the id of the
> naming container within which we searched for the id.
>
>
>> If I remove the f:ajax tag, load the page, and check the source, I see an
>> <img> tag:
>>
>> <img
>> id="form:j_id1186681689_16ef8569:0:j_id1186681689_16ef8513:j_id-1105909415_41ead6fe:image"
>> src="..."/>
>>
>> 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.
>>
>
> You'll need to use the ":" prefix within your render id to indicate that
> you are specifying an absolute id. If that does not work, then my guess is
> that there is an implementation bug here.
>
> Andy
>
>
>


-- 
Mit freundlichen Grüßen / Kind regards
Alexander Bell

J4Fry OpenSource Community
Internet: http://www.j4fry.org
E-Mail: Alexander.Bell@j4fry.org
Webprofil: http://www.j4fry.org/alexanderbell.shtml