Fix for JSFRI issue 167. Implement <c:ForEach> support.
Based on Ed's prototype patch attached to JSF RI 167
https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=166
M src/javax/faces/webapp/UIComponentClassicTagBase.java
- If a tag happens to be nested within <c:forEach>, jspId
will be the same for each iteration. So tranform it
to a unique "id" by using a counter that is
stored in request scope with jspId as the key.This counter
will be incremented everytime the same jspId is encountered.
jsf-ri/systest
=========
M build-tests.xml
- activate commented out test cases.
A src/com/sun/faces/jsptest/ForEachTestCase.java
M src/com/sun/faces/systest/model/TestBean.java
A web/forEach01.jsp
M web/WEB-INF/faces-config.xml
Test case for <c:forEach> (JSFRI issue 166)
Fix for JSFRI issue 167. Implement <c:ForEach> support
M src/javax/faces/webapp/UIComponentClassicTagBase.java
- If a tag happens to be nested within <c:forEach>, jspId
will be the same for each iteration. So tranform it
to a unique "id" by using a counter that is
stored in request scope with jspId as the key.This counter
will be incremented everytime the same jspId is encountered.
Index: build-tests.xml
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/systest/build-tests.xml,v
retrieving revision 1.88
diff -u -r1.88 build-tests.xml
--- build-tests.xml 10 Aug 2005 21:23:16 -0000 1.88
+++ build-tests.xml 12 Aug 2005 01:44:24 -0000
@@ -233,8 +233,8 @@
value="true"/>
-->
<batchtest todir="${test.results.dir}">
- <fileset dir="${basedir}/build/WEB-INF/classes"
- includes="com/sun/faces/jsptest/SetPropertyTestCase.class,com/sun/faces/jsptest/JspIntegrationTestCase.class,com/sun/faces/jsptest/ValidatorTestCase.class"/>
+ <fileset dir="${basedir}/build/WEB-INF/classes"
+ includes="com/sun/faces/jsptest/*TestCase.class"/>
</batchtest>
</junit>
@@ -826,7 +826,6 @@
recordGolden="${local.golden.path}/subview04.txt"
golden="${golden.path}/subview04.txt" failonerror="${failonerror}"/>
- <!-- PENDING(visvan) c:forEach tests.
<tester host="${host}" port="${port}" protocol="${protocol}"
request="${context.path}/faces/subview05.jsp"
recordGolden="${local.golden.path}/subview05.txt"
@@ -835,7 +834,7 @@
<tester host="${host}" port="${port}" protocol="${protocol}"
request="${context.path}/faces/subview06.jsp"
recordGolden="${local.golden.path}/subview06.txt"
- golden="${golden.path}/subview06.txt" failonerror="${failonerror}"/> -->
+ golden="${golden.path}/subview06.txt" failonerror="${failonerror}"/>
</target>
Index: src/com/sun/faces/systest/model/TestBean.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/systest/src/com/sun/faces/systest/model/TestBean.java,v
retrieving revision 1.16
diff -u -r1.16 TestBean.java
--- src/com/sun/faces/systest/model/TestBean.java 26 Jul 2005 14:09:30 -0000 1.16
+++ src/com/sun/faces/systest/model/TestBean.java 12 Aug 2005 01:44:24 -0000
@@ -36,6 +36,8 @@
public class TestBean {
private Random random;
+ private ArrayList newList1= new ArrayList();
+ private ArrayList newList2= new ArrayList();
public TestBean() {
random = new Random(4143);
@@ -464,6 +466,30 @@
return this.converterMessage;
}
+
+ public ArrayList getNewList1() {
+ return newList1;
+ }
+
+ public ArrayList getNewList2() {
+ return newList2;
+ }
+
+ public void valueChange1(ValueChangeEvent vce) {
+ String newValue = vce.getNewValue().toString();
+ if (newList1.size() == 3){
+ newList1.clear();
+ }
+ newList1.add(newValue);
+ }
+
+ public void valueChange2(ValueChangeEvent vce) {
+ String newValue = vce.getNewValue().toString();
+ if (newList2.size() == 3){
+ newList2.clear();
+ }
+ newList2.add(newValue);
+ }
}
Index: web/WEB-INF/faces-config.xml
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/systest/web/WEB-INF/faces-config.xml,v
retrieving revision 1.42
diff -u -r1.42 faces-config.xml
--- web/WEB-INF/faces-config.xml 3 Aug 2005 21:34:14 -0000 1.42
+++ web/WEB-INF/faces-config.xml 12 Aug 2005 01:44:24 -0000
@@ -89,6 +89,14 @@
</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
+
+ <managed-bean>
+ <managed-bean-name>test2</managed-bean-name>
+ <managed-bean-class>
+ com.sun.faces.systest.model.TestBean
+ </managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
<!-- Managed Bean #2, Primitive Property Overrides -->
@@ -462,6 +470,5 @@
<to-view-id>/renderkit04.jsp</to-view-id>
</navigation-case>
</navigation-rule>
-
</faces-config>
<%@ page contentType="text/html" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@ page import="java.util.*" %>
<% ArrayList list = new ArrayList();
list.add("output1"); list.add("output2"); list.add("output3");
pageContext.setAttribute("output", list, pageContext.SESSION_SCOPE);
ArrayList inputWithIdList = new ArrayList();
inputWithIdList.add("inputid1"); inputWithIdList.add("inputid2"); inputWithIdList.add("inputid3");
pageContext.setAttribute("inputWithIdList", inputWithIdList, pageContext.SESSION_SCOPE);
HashMap map1 = new HashMap();
map1.put("inputText1", "input1");
map1.put("inputText2", "input2");
map1.put("inputText3", "input3");
pageContext.setAttribute("input", map1, pageContext.SESSION_SCOPE);
%>
c:forEach Test