webtier@glassfish.java.net

Re: [webtier] Possible JSF2.0 PR UIComponent.findComponent() bug?

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Tue, 17 Feb 2009 16:38:41 -0800

Lincoln Baxter, III wrote:
> Hey Ryan,
>
> Is this to prevent duplicate IDs in the view? ID is always supposed to
> be unique in HTML/HTTP anyway, so I don't see a problem in enabling
> this from a convention standpoint.
>
> I'm trying to figure out the use case that would cause problems here.
> If you have a second could you give me your thoughts?
>
> I'm thinking maybe this is behavior that could be enhanced for JSF2? I
> feel that it may be a little counter-intuitive, even though there is a
> workaround. Is this documented?
I agree that it is a counter-intuitive. I will speak to the spec leads
about it next time I can corner them.
As to documented, I can't recall anything formal.

Will follow up once I know more.
>
> What do you think?
>
> --Lincoln
>
> On Tue, 2009-02-17 at 08:52 -0800, Ryan Lubke wrote:
>> Lincoln Baxter, III wrote:
>> > Seems like if the JSF form attribute "prependId" is set to "false",
>> > the UIViewRoot cannot find any Components within the form.
>> >
>> > When prependId is left on (defaults to true), this works.
>> >
>> > This also seems to be having trouble in nested tables. (I havent tried
>> > just one table yet.)
>> I believe this is working as intended. UIComponent.findComponent()
>> operates on naming containers.
>> When you have prependId set to false, then the naming container
>> information is lost.
>>
>> You could probably still get this to work, but you'd have to break it
>> into a couple of steps (basically
>> doing what the default findComponent() does when NamingContainer
>> information is present):
>>
>> 1. Call findComponent() for the top level form ID (assuming it's a
>> child of UIViewRoot and not nested
>> within another naming container)
>> 2. Using the form component found in step 1, search for the child of
>> interest.
>>
>>
>> >
>> > --Lincoln
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net <mailto:webtier-unsubscribe_at_glassfish.dev.java.net>
>> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net <mailto:webtier-help_at_glassfish.dev.java.net>
>>
>>