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 2012/06/19 10:55:52 UTC

svn commit: r1351610 - in /myfaces/core/trunk/impl/src: main/java/org/apache/myfaces/view/facelets/tag/jstl/core/ test/java/org/apache/myfaces/view/facelets/tag/jstl/core/ test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/

Author: lu4242
Date: Tue Jun 19 08:55:52 2012
New Revision: 1351610

URL: http://svn.apache.org/viewvc?rev=1351610&view=rev
Log:
MYFACES-3520 False evaluation of variables/params with the same name (c:forEach "var" and "varStatus" should be page scoped)

Added:
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach1.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach2.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach3.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach4.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach4_1.xhtml
Modified:
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/ForEachHandler.java
    myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jstl/core/JstlCoreTestCase.java

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/ForEachHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/ForEachHandler.java?rev=1351610&r1=1351609&r2=1351610&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/ForEachHandler.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/ForEachHandler.java Tue Jun 19 08:55:52 2012
@@ -27,7 +27,6 @@ import java.util.Map;
 
 import javax.el.ELException;
 import javax.el.ValueExpression;
-import javax.el.VariableMapper;
 import javax.faces.FacesException;
 import javax.faces.component.UIComponent;
 import javax.faces.view.facelets.FaceletContext;
@@ -39,7 +38,9 @@ import javax.faces.view.facelets.TagHand
 
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletAttribute;
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletTag;
+import org.apache.myfaces.view.facelets.AbstractFaceletContext;
 import org.apache.myfaces.view.facelets.FaceletCompositionContext;
+import org.apache.myfaces.view.facelets.PageContext;
 import org.apache.myfaces.view.facelets.tag.ComponentContainerHandler;
 import org.apache.myfaces.view.facelets.tag.jsf.ComponentSupport;
 
@@ -196,6 +197,8 @@ public final class ForEachHandler extend
         if (src != null)
         {
             fcc.startComponentUniqueIdSection();
+            AbstractFaceletContext actx = (AbstractFaceletContext) ctx;
+            PageContext pctx = actx.getPageContext();
             Iterator<?> itr = this.toIterator(src);
             if (itr != null)
             {
@@ -210,10 +213,9 @@ public final class ForEachHandler extend
 
                 String v = this.getVarName(ctx);
                 String vs = this.getVarStatusName(ctx);
-                VariableMapper vars = ctx.getVariableMapper();
                 ValueExpression ve = null;
-                ValueExpression vO = this.capture(v, vars);
-                ValueExpression vsO = this.capture(vs, vars);
+                ValueExpression vO = this.capture(v, pctx);
+                ValueExpression vsO = this.capture(vs, pctx);
                 int mi = 0;
                 Object value = null;
                 try
@@ -228,12 +230,21 @@ public final class ForEachHandler extend
                         {
                             if (t || srcVE == null)
                             {
-                                ctx.setAttribute(v, value);
+                                if (value == null)
+                                {
+                                    pctx.getAttributes().put(v, null);
+                                }
+                                else
+                                {
+                                    pctx.getAttributes().put(v, 
+                                            ctx.getExpressionFactory().createValueExpression(
+                                                value, Object.class));
+                                }
                             }
                             else
                             {
                                 ve = this.getVarExpr(srcVE, src, value, i);
-                                vars.setVariable(v, ve);
+                                pctx.getAttributes().put(v, ve);
                             }
                         }
 
@@ -243,12 +254,21 @@ public final class ForEachHandler extend
                             IterationStatus itrS = new IterationStatus(first, !itr.hasNext(), i, sO, eO, mO, value);
                             if (t || srcVE == null)
                             {
-                                ctx.setAttribute(vs, itrS);
+                                if (srcVE == null)
+                                {
+                                    pctx.getAttributes().put(vs, null);
+                                }
+                                else
+                                {
+                                    pctx.getAttributes().put(vs, 
+                                            ctx.getExpressionFactory().createValueExpression(
+                                                itrS, Object.class));
+                                }
                             }
                             else
                             {
                                 ve = new IterationStatusExpression(itrS);
-                                vars.setVariable(vs, ve);
+                                pctx.getAttributes().put(vs, ve);
                             }
                         }
 
@@ -270,13 +290,22 @@ public final class ForEachHandler extend
                 }
                 finally
                 {
+                    //Remove them from PageContext
                     if (v != null)
                     {
-                        vars.setVariable(v, vO);
+                        pctx.getAttributes().put(v, vO);
+                    }
+                    else
+                    {
+                        pctx.getAttributes().remove(v);
                     }
                     if (vs != null)
                     {
-                        vars.setVariable(vs, vsO);
+                        pctx.getAttributes().put(vs, vsO);
+                    }
+                    else
+                    {
+                        pctx.getAttributes().remove(vs);
                     }
                 }
             }
@@ -290,11 +319,11 @@ public final class ForEachHandler extend
         }
     }
 
-    private final ValueExpression capture(String name, VariableMapper vars)
+    private final ValueExpression capture(String name, PageContext pctx)
     {
         if (name != null)
         {
-            return vars.setVariable(name, null);
+            return pctx.getAttributes().put(name, null);
         }
         return null;
     }

Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jstl/core/JstlCoreTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jstl/core/JstlCoreTestCase.java?rev=1351610&r1=1351609&r2=1351610&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jstl/core/JstlCoreTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jstl/core/JstlCoreTestCase.java Tue Jun 19 08:55:52 2012
@@ -19,23 +19,30 @@
 
 package org.apache.myfaces.view.facelets.tag.jstl.core;
 
+import java.io.StringWriter;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
+import javax.el.ExpressionFactory;
 
 import javax.faces.component.UIComponent;
 import javax.faces.component.UIForm;
 import javax.faces.component.UIViewRoot;
 import javax.faces.component.html.HtmlCommandButton;
 import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.component.html.HtmlOutputText;
 import javax.faces.context.FacesContext;
 
 import org.apache.myfaces.renderkit.html.HtmlButtonRenderer;
 import org.apache.myfaces.renderkit.html.HtmlFormRenderer;
+import org.apache.myfaces.renderkit.html.HtmlTextRenderer;
 import org.apache.myfaces.test.mock.MockResponseWriter;
+import org.apache.myfaces.view.facelets.ELExpressionCacheMode;
 import org.apache.myfaces.view.facelets.FaceletTestCase;
 import org.apache.myfaces.view.facelets.bean.Employee;
+import org.apache.myfaces.view.facelets.impl.FaceletCompositionContextImpl;
 import org.apache.myfaces.view.facelets.util.FastWriter;
 import org.junit.Assert;
 import org.junit.Test;
@@ -43,6 +50,12 @@ import org.junit.Test;
 public final class JstlCoreTestCase extends FaceletTestCase {
 
     @Override
+    protected ExpressionFactory createExpressionFactory()
+    {
+        return new org.apache.el.ExpressionFactoryImpl();
+    }
+    
+    @Override
     protected void setupComponents() throws Exception
     {
         application.addComponent(UIViewRoot.COMPONENT_TYPE,
@@ -51,6 +64,11 @@ public final class JstlCoreTestCase exte
                 HtmlForm.class.getName());
         application.addComponent(HtmlCommandButton.COMPONENT_TYPE,
                 HtmlCommandButton.class.getName());
+        application.addComponent(HtmlInputText.COMPONENT_TYPE,
+                HtmlInputText.class.getName());
+        application.addComponent(HtmlOutputText.COMPONENT_TYPE,
+                HtmlOutputText.class.getName());
+        
     }
 
     @Override
@@ -65,6 +83,10 @@ public final class JstlCoreTestCase exte
                 "javax.faces.Form", new HtmlFormRenderer());
         renderKit.addRenderer(HtmlCommandButton.COMPONENT_FAMILY,
                 "javax.faces.Button", new HtmlButtonRenderer());
+        renderKit.addRenderer(HtmlInputText.COMPONENT_FAMILY,
+                "javax.faces.Text", new HtmlTextRenderer());
+        renderKit.addRenderer(HtmlOutputText.COMPONENT_FAMILY,
+                "javax.faces.Text", new HtmlTextRenderer());
     }
     
     @Test
@@ -109,13 +131,176 @@ public final class JstlCoreTestCase exte
         UIViewRoot root = facesContext.getViewRoot();
         vdl.buildView(facesContext, root,"forEach.xml");
         
-        FastWriter fw = new FastWriter();
-        MockResponseWriter mrw = new MockResponseWriter(fw);
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        
+        root.encodeAll(facesContext);
+        sw.flush();
+    }
+    
+    @Test
+    public void testForEach1() throws Exception {
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        Map session = facesContext.getExternalContext().getSessionMap();
+        Collection c = new ArrayList();
+        for (int i = 0; i < 10; i++) {
+            c.add(new Character((char)('A' + i)));
+        }
+        session.put("list", c);
+        
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root,"forEach1.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        Assert.assertTrue(sw.toString().contains("A = true/false"));
+        Assert.assertTrue(sw.toString().contains("B = false/false"));
+        Assert.assertTrue(sw.toString().contains("C = false/false"));
+        Assert.assertTrue(sw.toString().contains("D = false/false"));
+        Assert.assertTrue(sw.toString().contains("E = false/false"));
+        Assert.assertTrue(sw.toString().contains("F = false/false"));
+        Assert.assertTrue(sw.toString().contains("G = false/false"));
+        Assert.assertTrue(sw.toString().contains("H = false/false"));
+        Assert.assertTrue(sw.toString().contains("I = false/false"));
+        Assert.assertTrue(sw.toString().contains("J = false/true"));
+    }
+
+    /**
+     * Verify an outer c:set declaration does not affect the block
+     * after c:forEach
+     * 
+     * @throws Exception 
+     */
+    @Test
+    public void testForEach2() throws Exception {
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        Map session = facesContext.getExternalContext().getSessionMap();
+        Collection c = new ArrayList();
+        for (int i = 0; i < 10; i++) {
+            c.add(new Character((char)('A' + i)));
+        }
+        session.put("list", c);
+        
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root,"forEach2.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
         facesContext.setResponseWriter(mrw);
+        
         root.encodeAll(facesContext);
-        //System.out.println(fw);
+        sw.flush();
         
-        //System.out.println(root);
+        Assert.assertTrue(sw.toString().contains("value1 = /"));
+    }
+    
+    @Test
+    public void testForEach2CacheAlways() throws Exception
+    {
+        servletContext.addInitParameter(FaceletCompositionContextImpl.INIT_PARAM_CACHE_EL_EXPRESSIONS, 
+                ELExpressionCacheMode.always.toString());
+        testForEach2();
+    }
+
+
+    /**
+     * Verify an outer c:set declaration does not affect the inner block
+     * 
+     * @throws Exception 
+     */
+    @Test
+    public void testForEach3() throws Exception {
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        Map session = facesContext.getExternalContext().getSessionMap();
+        Collection c = new ArrayList();
+        for (int i = 0; i < 10; i++) {
+            c.add(new Character((char)('A' + i)));
+        }
+        session.put("list", c);
+        
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root,"forEach3.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        Assert.assertTrue(sw.toString().contains("A = true/false"));
+        Assert.assertTrue(sw.toString().contains("B = false/false"));
+        Assert.assertTrue(sw.toString().contains("C = false/false"));
+        Assert.assertTrue(sw.toString().contains("D = false/false"));
+        Assert.assertTrue(sw.toString().contains("E = false/false"));
+        Assert.assertTrue(sw.toString().contains("F = false/false"));
+        Assert.assertTrue(sw.toString().contains("G = false/false"));
+        Assert.assertTrue(sw.toString().contains("H = false/false"));
+        Assert.assertTrue(sw.toString().contains("I = false/false"));
+        Assert.assertTrue(sw.toString().contains("J = false/true"));
+        Assert.assertFalse(sw.toString().contains("value1 ="));
+    }
+    
+    @Test
+    public void testForEach3CacheAlways() throws Exception
+    {
+        servletContext.addInitParameter(FaceletCompositionContextImpl.INIT_PARAM_CACHE_EL_EXPRESSIONS, 
+                ELExpressionCacheMode.always.toString());
+        testForEach3();
+    }
+
+
+    /**
+     * Verify encapsulation principle for definitions of c:forEach and ui:param
+     * 
+     * @throws Exception 
+     */
+    @Test
+    public void testForEach4() throws Exception {
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        Map session = facesContext.getExternalContext().getSessionMap();
+        Collection c = new ArrayList();
+        for (int i = 0; i < 10; i++) {
+            c.add(new Character((char)('A' + i)));
+        }
+        session.put("list", c);
+        
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root,"forEach4.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        Assert.assertTrue(sw.toString().contains("value = A"));
+        Assert.assertTrue(sw.toString().contains("value = B"));
+        Assert.assertTrue(sw.toString().contains("value = C"));
+        Assert.assertTrue(sw.toString().contains("value = D"));
+        Assert.assertTrue(sw.toString().contains("value = E"));
+        Assert.assertTrue(sw.toString().contains("value = F"));
+        Assert.assertTrue(sw.toString().contains("value = G"));
+        Assert.assertTrue(sw.toString().contains("value = H"));
+        Assert.assertTrue(sw.toString().contains("value = I"));
+        Assert.assertTrue(sw.toString().contains("value = J"));
+        Assert.assertTrue(!sw.toString().contains("value = value"));
+        Assert.assertTrue(!sw.toString().contains("A = A"));
+    }
+
+    @Test
+    public void testForEach4CacheAlways() throws Exception
+    {
+        servletContext.addInitParameter(FaceletCompositionContextImpl.INIT_PARAM_CACHE_EL_EXPRESSIONS, 
+                ELExpressionCacheMode.always.toString());
+        testForEach4();
     }
 
 }

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach1.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach1.xhtml?rev=1351610&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach1.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach1.xhtml Tue Jun 19 08:55:52 2012
@@ -0,0 +1,28 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Id: forEach.xml 884721 2009-11-26 23:31:11Z lu4242 $
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:ui="http://java.sun.com/jsf/facelets"
+      xmlns:h="http://java.sun.com/jsf/html"
+      xmlns:c="http://java.sun.com/jsp/jstl/core">
+<body>
+
+<ui:composition>
+<c:forEach items="#{list}" var="i" varStatus="s" begin="0" end="10">
+#{i} = #{s.first}/#{s.last}</c:forEach>
+</ui:composition>
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach2.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach2.xhtml?rev=1351610&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach2.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach2.xhtml Tue Jun 19 08:55:52 2012
@@ -0,0 +1,30 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Id: forEach.xml 884721 2009-11-26 23:31:11Z lu4242 $
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:ui="http://java.sun.com/jsf/facelets"
+      xmlns:h="http://java.sun.com/jsf/html"
+      xmlns:c="http://java.sun.com/jsp/jstl/core">
+<body>
+
+<ui:composition>
+<c:set var="i" value="value1"/>
+<c:forEach items="#{list}" var="i" varStatus="s" begin="0" end="10">
+</c:forEach>
+<h:outputText value="#{i} = #{s.first}/#{s.last}"/>
+</ui:composition>
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach3.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach3.xhtml?rev=1351610&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach3.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach3.xhtml Tue Jun 19 08:55:52 2012
@@ -0,0 +1,30 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Id: forEach.xml 884721 2009-11-26 23:31:11Z lu4242 $
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:ui="http://java.sun.com/jsf/facelets"
+      xmlns:h="http://java.sun.com/jsf/html"
+      xmlns:c="http://java.sun.com/jsp/jstl/core">
+<body>
+
+<ui:composition>
+<c:set var="i" value="value1"/>
+<c:forEach items="#{list}" var="i" varStatus="s" begin="0" end="10">
+    <h:outputText value="#{i} = #{s.first}/#{s.last}"/>
+</c:forEach>
+</ui:composition>
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach4.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach4.xhtml?rev=1351610&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach4.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach4.xhtml Tue Jun 19 08:55:52 2012
@@ -0,0 +1,31 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Id: forEach.xml 884721 2009-11-26 23:31:11Z lu4242 $
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:ui="http://java.sun.com/jsf/facelets"
+      xmlns:h="http://java.sun.com/jsf/html"
+      xmlns:c="http://java.sun.com/jsp/jstl/core">
+<body>
+<ui:composition>
+    <ui:decorate template="forEach4_1.xhtml">
+       <ui:param name="i" value="value"/>
+       <ui:define name="header">
+         <h:outputText value="#{i}"/>
+       </ui:define>
+    </ui:decorate>
+</ui:composition>
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach4_1.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach4_1.xhtml?rev=1351610&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach4_1.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jstl/core/forEach4_1.xhtml Tue Jun 19 08:55:52 2012
@@ -0,0 +1,29 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Id: forEach.xml 884721 2009-11-26 23:31:11Z lu4242 $
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:ui="http://java.sun.com/jsf/facelets"
+      xmlns:h="http://java.sun.com/jsf/html"
+      xmlns:c="http://java.sun.com/jsp/jstl/core">
+<body>
+
+<ui:composition>
+  <c:forEach items="#{list}" var="i" varStatus="s" begin="0" end="10">
+      <ui:insert name="header"/> = #{i}
+  </c:forEach>
+</ui:composition>
+</body>
+</html>
\ No newline at end of file