UIComponent.setId()'s JavaDoc says: The specified identifier must be unique among all the components (including facets) that are descendents of the nearest ancestor UIComponent that is a NamingContainer, or within the scope of the entire component tree if there is no such ancestor that is a NamingContainer.
so this is fine: <h:inputText id="foo" value="..."/> <h:form id="bar"> <h:inputText id="foo" .../> </h:form> but it is not ok to have inside of <h:form/> two or more components with the same ID like: <!-- not valid --> <h:form id="bar"> <h:inputText id="foo"/> <h:inputText id="foo"/> </h:form> BTW the spec says: Components in the tree can be located based on component identifiers, which must be unique within the scope of the nearest ancestor to the component that is a naming container. and Every component may be named by a component identifier, which (if utilized) must be unique among the components that share a common naming container parent in a component tree. Component identifiers must conform to the following rules: ... If a component has been given an identifier, it must be unique in the namespace of the closest ancestor to that component that is a NamingContainer (if any). > -----Original Message----- > From: Heath Borders [mailto:[EMAIL PROTECTED] > Sent: Tuesday, January 11, 2005 2:18 AM > To: Sean Schofield > Cc: MyFaces Discussion > Subject: Re: Need help with getViewRoot and attributes > > > JSF doesn't require Ids to be unique over the whole tree, > however, it does require that clientIds are unique throughout > the component tree (I'm pretty sure). > > > On Mon, 10 Jan 2005 18:55:57 -0500, Sean Schofield > <[EMAIL PROTECTED]> wrote: > > > Again, the renderer doesn't need to solve this problem because it > > > also concerns the how the tree is reconstructed. It is > not just an > > > (X)HTML problem. That's why the checking code should stay within > > > the > > > getClientId(FacesContext) method on the individidual > UIComponents (but > > > not on UIComponentBase because this behavior is not > specified by the > > > API). > > > > Yes but the renderer handles the reconstruction of the > compoenent tree > > (at least the updating of the components with the form data.) > > > > So we are all in agreement that the JSF spec does not technically > > require unique ids for *every* component in the tree? This was the > > first point I was trying to argue. I wasn't sure myself, but Craig > > seems to have settled this one. > > > > I agree that UIComponentBase should be left alone (and this is how > > I've implemented it for now.) My only point is that since > JSF doesn't > > really require the id's to be unique throughout the entire > tree, that > > requirement is probably best handled through the renderer > (if possible > > which its not right now) because only XHTML cares about this > > requirement. > > > > Probably not much use in us debating this further since I only > > disagree with you in theory. Unfortunately the reality is that the > > solution I think is best is not possible right now. > > > > > -Heath Borders-Wing > > > > sean > > > > > -- > -Heath Borders-Wing > [EMAIL PROTECTED] >