Yes. That's why I searched for a way to work around this, and I found one.
I'm still inline with the Spec JavaDoc excerpt you posted - the id's are still prepended with UNIQUE_ID_PREFIX. I wouldn't expect users to rely on the fact that the ids usually end with a number after this unique_id_prefix. regards, Martin On 7/14/06, Jacob Hookom <[EMAIL PROTECTED]> wrote:
From the JavaDoc (1.1): "Generate an identifier for a component. The identifier will be prefixed with UNIQUE_ID_PREFIX, and will be unique within this UIViewRoot." But resetting it on every encode breaks this contract, because the UIViewRoot and other UIComponents survived across multiple encodes/requests. So it was a bug that was shared between the RI and MyFaces. Martin Marinschek wrote: > You knew that in 1.1 this wouldn't work, right? > > the createUniqueId counter would have been reset on every request, > both in the RI and MyFaces. > > regards, > > Martin > > On 7/13/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> I'm not completely sure how Ed has setup the JSF JSP tags, but >> Facelets goes purely off of the expectation that the UIViewRoot will >> always produce a new unique value. >> >> When we bring in concepts like JspIdConsumer, which Facelets has too >> with TagIds-- but it's only internal to the [Tag]Handler and >> shouldn't need to be used as identifiers on the resulting output. >> >> Basically, each invocation of the Tag, the page's [Jsp]Id will be >> assigned. The Tomcat 6 stuff I worked on does something like: >> >> [URI HASH] + [POS OF TAG] + [COUNTER UNIQUE TO THIS TAG] >> >> The reason for this is repeatability for mark'n'sweep processing. >> We'd like to be able to compare set identifiers on the component >> model for succeeding passes to know when a component is brought in >> our out of the Component Tree while allowing for JSTL/Control tags in >> the page. >> >> Facelets instead sets a unique Attribute on the UIComponent, leaving >> the actual ID up to the UIViewRoot/Impl. >> >> -- Jacob >> >> >Yes, my qualm is with the 'jsp' prefix. My problem is that (even though >> >it would be good if we didn't) we have many automated tests that have >> >been written using the old ids (and they are the same ids as the RI, so >> >the same tests work with the RI as well). >> > >> >I know the 'right' long-term solution is to make our tests >> >id-independent (or assign ids to everything in out JSP file). Given >> that >> >this isn't a JSF 1.2 implementation, I was hoping for a short term fix >> >to my problem, but it sounds like your current solution depends on the >> >prefix being different from the Servlet id prefix. >> > >> >> -----Original Message----- >> >> From: Jacob Hookom [mailto:[EMAIL PROTECTED] >> >> Sent: Wednesday, July 12, 2006 11:51 PM >> >> To: MyFaces Development >> >> Subject: Re: Ids in 1.1.3 and 1.1.4 >> >> >> >> Unique Id generation aside, I think the qualm was with the 'jsp' >> >prefix >> >> in the generated IDs. I know that JSP 2.1 has the ability to assign >> >ids >> >> unique to a tag on a page, but that's different than what you are >> >> describing. >> >> >> >> Martin Marinschek wrote: >> >> > The problem is that there is a bug in the spec here. >> >> > >> >> > If you called createUniqueId in earlier MyFaces versions, you would >> >> > receive a unique id, but only unique for one request. On the next >> >> > request, the sequence would be restarted. This would make working >> >with >> >> > dynamic component creation exceptionally hard, if not >> impossible. On >> >> > subsequent requests, the sequence counter would'nt start anew, and >> >> > you'd get DuplicateIdExceptions all over! >> >> > >> >> > To fix this, we went to be more inline with what JSF1.2 foresees >> for >> >> > id creation. JSF 1.2 wants the servlet container to create unique >> >ids >> >> > - so we loose control about the ids produced, and createUniqueId is >> >> > never called. Note: when we all move to 1.2, you won't know about >> >the >> >> > id-syntax anymore anyways - the servlet container provides the >> >unique >> >> > ids then. >> >> > >> >> > We implemented a partial solution of this - we have a separate >> >counter >> >> > for JSP-tags; and those ids are produced out of a different >> >sequence. >> >> > To make sure that the id's don't match, we prepend a "jsp" in front >> >of >> >> > the actual unique id counter. >> >> > >> >> > With this solution, we can store the current sequence counter of >> >> > createUniqueId between requests, and dynamic component creation is >> >not >> >> > a problem anymore! >> >> > >> >> > I wonder why you would need the component id to have a special >> >syntax? >> >> > Do you rely in any way on this? >> >> > >> >> > regards, >> >> > >> >> > Martin >> >> > >> >> > On 7/12/06, *Gary VanMatre* <[EMAIL PROTECTED] >> >> > <mailto:[EMAIL PROTECTED]>> wrote: >> >> > >> >> > >From: "Matthias Wessendorf" <[EMAIL PROTECTED] >> >> > <mailto:[EMAIL PROTECTED]>> >> >> > >> >> > > >> >> > > Hey Howard, >> >> > > >> >> > > you mean stuff like ? >> >> > > >> >> > > >> >> > >> >> > >> >> > > >> >> > >> >> > >> >> > > Was introduced in " Revision 359449" >> >> > > >> >> > > see >> >> > > http://svn.apache.org/viewvc?view=rev&revision=359449 >> >> > <http://svn.apache.org/viewvc?view=rev&revision=359449> >> >> > > >> >> > > I can't tell you much about that. sorry! >> >> > > >> >> > >> >> > >> >> > >> >> > I did some research on this for Shale Clay. Clay has to >> >> > conditionally decide to use the ViewRoot to create a unique id >> >or >> >> > use another method. It looks like it has to do with partial >> >page >> >> > rendering. I suspect it was added for ajax component support. >> >> > >> >> > That's pretty much the same answer as Matthias. >> >> > >> >> > >> >> > >> >> > > -Matt >> >> > >> >> > Gary >> >> > >> >> > > >> >> > > On 7/12/06, Abrams, Howard A wrote: >> >> > > > >> >> > > > >> >> > > > >> >> > > > >> >> > > > Hi, >> >> > > > >> >> > > > >> >> > > > >> >> > > > Is there any reason why the UIComponentTag appends "jsp" to >> >all >> >> > the >> >> > > > component ids in 1.1.3/1.1.4? Any chance this can be >> removed >> >> > for 1.1.4 so >> >> > > > that it returns the same ids as UIViewRoot.createUniqueId() >> >and >> >> > the RI? >> >> > > > >> >> > > > >> >> > > > >> >> > > > Thanks, >> >> > > > >> >> > > > h >> >> > > >> >> > > >> >> > > -- >> >> > > Matthias Wessendorf >> >> > > >> >> > > further stuff: >> >> > > blog: http://jroller.com/page/mwessendorf >> >> > > mail: mwessendorf-at-gmail-dot-com >> >> > >> >> > >> >> > >> >> > >> >> > -- >> >> > >> >> > http://www.irian.at >> >> > >> >> > Your JSF powerhouse - >> >> > JSF Consulting, Development and >> >> > Courses in English and German >> >> > >> >> > Professional Support for Apache MyFaces >> >> >> >> >> >> -- >> >> -------------------------- >> >> Sent from my FrankenBerry Wireless Handheld >> >> >> > >> > > -- -------------------------- Sent from my FrankenBerry Wireless Handheld
-- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces
