[ 
https://issues.apache.org/jira/browse/MYFACES-2428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12784459#action_12784459
 ] 

Leonardo Uribe commented on MYFACES-2428:
-----------------------------------------

After doing some tests on this issue, use components that implements 
UniqueIdVendors to define ids cause more problems.

The problem is that is expected that some components on the tree are relocated. 
We can fix h:outputScript and h:outputStylesheet, but we can't do anything 
clean with composite:insertChildren or composite:insertFacet, because in that 
case we could have nested and mixed declaration of it and since we need the 
tree built before start to move, in that case we need to regenerate ids for all 
components that has a generated id.

I check again the problem with htmlunit and  it starts with the addition of '-' 
char inside generated ids. It seems more simple to prevent the 
DefaultFaceletContext.generateUniqueId insert this chars by a simple call to 
Math.abs. Use the generated id based from the alias name and tag position in a 
page seems to be the best solution in this case.

> Id generation for facelets cause problems with htmlunit 2.4 or lower
> --------------------------------------------------------------------
>
>                 Key: MYFACES-2428
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2428
>             Project: MyFaces Core
>          Issue Type: Task
>          Components: JSR-314
>            Reporter: Leonardo Uribe
>            Assignee: Leonardo Uribe
>
> The id generation strategy is critical to allow partial state saving works 
> correctly, because all component state is saved on a map, and the clientId is 
> the primary key for it.
> Actually, we just pass the facelet generated id for each tag as a seed for 
> UniqueIdVendor.createUniqueId(FacesContext context, java.lang.String seed), 
> This id cause an exception in htmlunit version 2.4 or lower (in 2.5 this was 
> fixed).
> The objective of UniqueIdVendor interface is reduce the variation when ids 
> are generated. The ideal case is that for any facelet page the generated ids 
> assigned to components should remain the same no matter if the model changes 
> by some reason.
> The problem starts when it is used <c:forEach> or <c:if> tags, because its 
> behavior depends on the "model" state in a point of the time. The id 
> generated by facelets is depends on the facelet "alias" page name, a counter 
> id from CompilationManager.
> We need to do multiple tests for worst case scenarios, and try to define an 
> strategy to reduce the variability of ids, providing proper "seeds" for it. 
> Suggestions are welcome

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to