You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2013/04/12 01:42:16 UTC

svn commit: r1467144 - /myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletContext.java

Author: lu4242
Date: Thu Apr 11 23:42:15 2013
New Revision: 1467144

URL: http://svn.apache.org/r1467144
Log:
MYFACES-3709 metadata - component with duplicate id

Modified:
    myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletContext.java

Modified: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletContext.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletContext.java?rev=1467144&r1=1467143&r2=1467144&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletContext.java (original)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletContext.java Thu Apr 11 23:42:15 2013
@@ -319,17 +319,20 @@ final class DefaultFaceletContext extend
         if (uniqueIdFromIterator == null)
         {
             getFaceletCompositionContext().generateUniqueId(_uniqueIdBuilder);
-            _uniqueIdBuilder.append("_");
-            _uniqueIdBuilder.append(_prefix);
             // Since two different facelets are used to build the metadata, it is necessary
             // to trim the "base" part from the returned unique id, to ensure the components will be
             // refreshed properly. Note the "base" part is the one that allows to ensure
             // uniqueness between two different facelets with the same <f:metadata>, but since by 
             // spec view metadata sections cannot live on template client facelets, this case is
             // just not possible. 
+            // MYFACES-3709 It was also noticed that in some cases, the prefix should also
+            // be excluded from the id. The prefix is included if the metadata section is
+            // applied inside an included section (by ui:define and ui:insert for example).
             if (!getFaceletCompositionContext().isInMetadataSection())
             {
                 _uniqueIdBuilder.append("_");
+                _uniqueIdBuilder.append(_prefix);
+                _uniqueIdBuilder.append("_");
                 _uniqueIdBuilder.append(base);
             }
             uniqueIdFromIterator = _uniqueIdBuilder.toString();