Hi,

As part of my investigations of
  http://issues.apache.org/jira/browse/MYFACES-856
I have found that I need to understand how a UIComponentTag finds its corresponding component.

When a JSP page is processed, each time a jsf tag is encountered a UIComponentTag instance is created, initialised with the tag attributes, and then doStartTag is invoked.

On the first visit to a view, there is no problem: each UIComponentTag simply creates its corresponding component.

However on a re-render the UIComponentTag has to locate the appropriate UIComponent instance in the view (see method findComponent). It's important that it does this correctly, as this is how components with failed validation (whose value to render is stored in the component's _submittedValue member) render their value into the correct place in the response.

The UIComponentTag knows its parent tag, and its parent tag knows its component. So far so good.

Now if the tag in question has an explicit id assigned by the user then there's no problem: a search is done in the children of the parent tag's component for a matching id.

But what happens if the tag has an auto-generated id?

It looks to me like the "reconnection" process then depends upon UIViewRoot generating anonymous ids in exactly the same sequence as on the first view.

Won't this fail horribly if on re-render of a page there are more or less JSF tags present than there were previously? UIComponentTags will then "find" the wrong UIComponents, potentially of completely the wrong type for that tag.


The methods UIComponentTag.removeFormerChildren/removeFormerFacets are in this class explicitly to handle cases where re-rendering of a view finds that JSF components have been added or removed. I had assumed that this was to handle JSTL c:if tags enclosing JSF tags in a page, and similar situations. Is this not the case? Perhaps this is not supported at all, and the removeFormerChildren method is there only to handle cases where components were programmatically added?

Is this all perhaps related to the mysterious comment in UIComponentBase.getClientId?
   if (id == null)
   {
      //Although this is an error prone side effect, we
      // automatically create a new id
      //just to be compatible to the RI


Thanks in advance for any info,

Simon

Reply via email to