Closed ren-zhijun-oracle closed 8 years ago
@javaserverfaces Commented Reported by @ruolli
@javaserverfaces Commented @ruolli said:
ruolli@ruolli-Ubuntu: ~/GIT/mojarra~git/test $ git diff HEAD^ HEAD
diff --git a/jsf-ri/src/main/java/com/sun/faces/facelets/tag/jsf/ComponentSupport.java b/jsf-ri/src/main/java/com/sun/faces/facelets/tag/jsf/ComponentSupport.java
index d45ddfd..ed936a9 100644
--- a/jsf-ri/src/main/java/com/sun/faces/facelets/tag/jsf/ComponentSupport.java
+++ b/jsf-ri/src/main/java/com/sun/faces/facelets/tag/jsf/ComponentSupport.java
@@ -253,7 +253,7 @@ public final class ComponentSupport {
* @return the UI component
*/
public static UIComponent findChildByTagId(FacesContext context, UIComponent parent, String id) {
- if (!context.isPostback() || context.getCurrentPhaseId().equals(PhaseId.RESTORE_VIEW)) {
+ if ( !context.isPostback() ) {
return null;
}
UIComponent c = null;
diff --git a/test/javaee6/facelets/pom.xml b/test/javaee6/facelets/pom.xml
new file mode 100644
index 0000000..9c8d852
--- /dev/null
+++ b/test/javaee6/facelets/pom.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright (c) 1997-2014 Oracle and/or its affiliates. All rights reserved.
+
+ The contents of this file are subject to the terms of either the GNU
+ General Public License Version 2 only ("GPL") or the Common Development
+ and Distribution License("CDDL") (collectively, the "License"). You
+ may not use this file except in compliance with the License. You can
+ obtain a copy of the License at
+ https://glassfish.java.net/public/CDDL+GPL_1_1.html
+ or packager/legal/LICENSE.txt. See the License for the specific
+ language governing permissions and limitations under the License.
+
+ When distributing the software, include this License Header Notice in each
+ file and include the License file at packager/legal/LICENSE.txt.
+
+ GPL Classpath Exception:
+ Oracle designates this particular file as subject to the "Classpath"
+ exception as provided by Oracle in the GPL Version 2 section of the License
+ file that accompanied this code.
+
+ Modifications:
+ If applicable, add the following below the License Header, with the fields
+ enclosed by brackets [] replaced by your own identifying information:
+ "Portions Copyright [year] [name of copyright owner]"
+
+ Contributor(s):
+ If you wish your version of this file to be governed by only the CDDL or
+ only the GPL Version 2, indicate your decision by adding "[Contributor]
+ elects to include this software in this distribution under the [CDDL or GPL
+ Version 2] license." If you don't indicate a single choice of license, a
+ recipient has the option to distribute your version of this file under
+ either the CDDL, the GPL Version 2 or to extend the choice of license to
+ its licensees as provided above. However, if you add GPL Version 2 code
+ and therefore, elected the GPL Version 2 license, then the option applies
+ only if the new code is made subject to such option by the copyright
+ holder.
+
+--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>com.sun.faces.test.javaee6</groupId>
+ <artifactId>pom</artifactId>
+ <version>2.1.20-10-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>facelets</artifactId>
+ <packaging>war</packaging>
+ <name>Mojarra ${project.version} - Test - JavaEE 6 - Facelets</name>
+ <build>
+ <finalName>test-javaee6-facelets</finalName>
+ </build>
+</project>
diff --git a/test/javaee6/facelets/src/main/java/com/sun/faces/test/javaee6/facelets/DuplicateController.java b/test/javaee6/facelets/src/main/java/com/sun/faces/test/javaee6/facelets/Dupli
new file mode 100644
index 0000000..f5c1fba
--- /dev/null
+++ b/test/javaee6/facelets/src/main/java/com/sun/faces/test/javaee6/facelets/DuplicateController.java
@@ -0,0 +1,87 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 1997-2015 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can
+ * obtain a copy of the License at
+ * https://glassfish.java.net/public/CDDL+GPL_1_1.html
+ * or packager/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at packager/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+package com.sun.faces.test.javaee6.facelets;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
+import javax.faces.component.html.HtmlDataTable;
+
+@ManagedBean(
+ name = "duplicateController"
+)
+@ViewScoped
+public class DuplicateController {
+ private static final long serialVersionUID = 1L;
+ private List<String> itemsList = new ArrayList();
+ private HtmlDataTable dataTable;
+
+ public DuplicateController() {
+ }
+
+ public void createNewRow() {
+ this.incRows();
+ String s = "new:" + (new Object()).hashCode();
+ this.itemsList.add(0, s);
+ }
+
+ private void incRows() {
+ int rows = this.dataTable.getRows();
+ this.dataTable.setRows(rows + 1);
+ }
+
+ public HtmlDataTable getDataTable() {
+ return this.dataTable;
+ }
+
+ public void setDataTable(HtmlDataTable dataTable) {
+ this.dataTable = dataTable;
+ }
+
+ public List<String> getItemsList() {
+ return this.itemsList;
+ }
+
+ public void setItemsList(List<String> itemsList) {
+ this.itemsList = itemsList;
+ }
+}
+
diff --git a/test/javaee6/facelets/src/main/webapp/WEB-INF/beans.xml b/test/javaee6/facelets/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..4ca8195
--- /dev/null
+++ b/test/javaee6/facelets/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+</beans>
diff --git a/test/javaee6/facelets/src/main/webapp/WEB-INF/faces-config.xml b/test/javaee6/facelets/src/main/webapp/WEB-INF/faces-config.xml
new file mode 100644
index 0000000..c1cacaa
--- /dev/null
+++ b/test/javaee6/facelets/src/main/webapp/WEB-INF/faces-config.xml
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<faces-config version="2.0"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
+</faces-config>
diff --git a/test/javaee6/facelets/src/main/webapp/WEB-INF/web.xml b/test/javaee6/facelets/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..443a4a3
--- /dev/null
+++ b/test/javaee6/facelets/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright (c) 1997-2014 Oracle and/or its affiliates. All rights reserved.
+
+ The contents of this file are subject to the terms of either the GNU
+ General Public License Version 2 only ("GPL") or the Common Development
+ and Distribution License("CDDL") (collectively, the "License"). You
+ may not use this file except in compliance with the License. You can
+ obtain a copy of the License at
+ https://glassfish.java.net/public/CDDL+GPL_1_1.html
+ or packager/legal/LICENSE.txt. See the License for the specific
+ language governing permissions and limitations under the License.
+
+ When distributing the software, include this License Header Notice in each
+ file and include the License file at packager/legal/LICENSE.txt.
+
+ GPL Classpath Exception:
+ Oracle designates this particular file as subject to the "Classpath"
+ exception as provided by Oracle in the GPL Version 2 section of the License
+ file that accompanied this code.
+
+ Modifications:
+ If applicable, add the following below the License Header, with the fields
+ enclosed by brackets [] replaced by your own identifying information:
+ "Portions Copyright [year] [name of copyright owner]"
+
+ Contributor(s):
+ If you wish your version of this file to be governed by only the CDDL or
+ only the GPL Version 2, indicate your decision by adding "[Contributor]
+ elects to include this software in this distribution under the [CDDL or GPL
+ Version 2] license." If you don't indicate a single choice of license, a
+ recipient has the option to distribute your version of this file under
+ either the CDDL, the GPL Version 2 or to extend the choice of license to
+ its licensees as provided above. However, if you add GPL Version 2 code
+ and therefore, elected the GPL Version 2 license, then the option applies
+ only if the new code is made subject to such option by the copyright
+ holder.
+
+-->
+
+<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+ <context-param>
+ <param-name>javax.faces.PROJECT_STAGE</param-name>
+ <param-value>${webapp.projectStage}</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
+ <param-value>${webapp.partialStateSaving}</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>${webapp.stateSavingMethod}</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.SERIALIZE_SERVER_STATE</param-name>
+ <param-value>${webapp.serializeServerState}</param-value>
+ </context-param>
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ </servlet-mapping>
+ <session-config>
+ <session-timeout>30</session-timeout>
+ </session-config>
+</web-app>
diff --git a/test/javaee6/facelets/src/main/webapp/issue4124.xhtml b/test/javaee6/facelets/src/main/webapp/issue4124.xhtml
new file mode 100644
index 0000000..48f3512
--- /dev/null
+++ b/test/javaee6/facelets/src/main/webapp/issue4124.xhtml
@@ -0,0 +1,73 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<!--
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright (c) 1997-2015 Oracle and/or its affiliates. All rights reserved.
+
+ The contents of this file are subject to the terms of either the GNU
+ General Public License Version 2 only ("GPL") or the Common Development
+ and Distribution License("CDDL") (collectively, the "License"). You
+ may not use this file except in compliance with the License. You can
+ obtain a copy of the License at
+ https://glassfish.java.net/public/CDDL+GPL_1_1.html
+ or packager/legal/LICENSE.txt. See the License for the specific
+ language governing permissions and limitations under the License.
+
+ When distributing the software, include this License Header Notice in each
+ file and include the License file at packager/legal/LICENSE.txt.
+
+ GPL Classpath Exception:
+ Oracle designates this particular file as subject to the "Classpath"
+ exception as provided by Oracle in the GPL Version 2 section of the License
+ file that accompanied this code.
+
+ Modifications:
+ If applicable, add the following below the License Header, with the fields
+ enclosed by brackets [] replaced by your own identifying information:
+ "Portions Copyright [year] [name of copyright owner]"
+
+ Contributor(s):
+ If you wish your version of this file to be governed by only the CDDL or
+ only the GPL Version 2, indicate your decision by adding "[Contributor]
+ elects to include this software in this distribution under the [CDDL or GPL
+ Version 2] license." If you don't indicate a single choice of license, a
+ recipient has the option to distribute your version of this file under
+ either the CDDL, the GPL Version 2 or to extend the choice of license to
+ its licensees as provided above. However, if you add GPL Version 2 code
+ and therefore, elected the GPL Version 2 license, then the option applies
+ only if the new code is made subject to such option by the copyright
+ holder.
+
+-->
+
+
+<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:f="http://java.sun.com/jsf/core">
+
+<f:view>
+ <h:body>
+ <h:form prependId="false" id="hForm">
+ <h:dataTable prependId="false" id="duplicatesTable"
+ binding="#{duplicateController.dataTable}"
+ value="#{duplicateController.itemsList}"
+var="s" rowKey="#{s}">
+
+ <h:column prependId="false" id="pColumn">
+ <f:facet name="header">
+ <h:commandButton prependId="false" id="pSplitButton"
+ actionListener="#{duplicateController.createNewRow}"
+ update="duplicatesTable" value="Add Row">
+ </h:commandButton>
+ </f:facet>
+ <h:outputText id="hOutputText" value="#{s}" />
+ </h:column>
+ </h:dataTable>
+ </h:form>
+ </h:body>
+</f:view>
+</html>
diff --git a/test/javaee6/facelets/src/test/java/com/sun/faces/test/javaee6/facelets/Issue4124IT.java b/test/javaee6/facelets/src/test/java/com/sun/faces/test/javaee6/facelets/Issue4124IT.j
new file mode 100644
index 0000000..c2e4a65
--- /dev/null
+++ b/test/javaee6/facelets/src/test/java/com/sun/faces/test/javaee6/facelets/Issue4124IT.java
@@ -0,0 +1,98 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 1997-2016 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can
+ * obtain a copy of the License at
+ * https://glassfish.java.net/public/CDDLGPL_1_1.html
+ * or packager/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at packager/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+package com.sun.faces.test.javaee6.facelets;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.DomElement;
+import com.gargoylesoftware.htmlunit.html.DomNode;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import java.util.Iterator;
+import static org.junit.Assert.*;
+
+public class Issue4124IT {
+
+ private String webUrl;
+ private WebClient webClient;
+
+ @Before
+ public void setUp() {
+ webUrl = System.getProperty("integration.url");
+ webClient = new WebClient();
+ webClient.setJavaScriptTimeout(120000);
+ }
+
+ @Test
+ public void testIssue4124() throws Exception {
+
+ HtmlPage page = webClient.getPage(webUrl + "faces/issue4124.xhtml");
+ DomNode dn = page.getHtmlElementById("duplicatesTable").getLastChild();
+ int count = dn.getChildNodes().size();
+ assertTrue(count == 1);
+
+ page = page.getHtmlElementById("duplicatesTable:pSplitButton").click();
+ dn = page.getHtmlElementById("duplicatesTable").getLastChild();
+ count = dn.getChildNodes().size();
+ assertTrue(count == 1);
+
+ page = page.getHtmlElementById("duplicatesTable:pSplitButton").click();
+ dn = page.getHtmlElementById("duplicatesTable").getLastChild();
+ count = dn.getChildNodes().size();
+ assertTrue(count == 2);
+
+ page = page.getHtmlElementById("duplicatesTable:pSplitButton").click();
+ dn = page.getHtmlElementById("duplicatesTable").getLastChild();
+ count = dn.getChildNodes().size();
+ assertTrue(count == 3);
+
+ }
+
+ @After
+ public void tearDown() {
+ webClient.closeAllWindows();
+ }
+
+}
diff --git a/test/javaee6/pom.xml b/test/javaee6/pom.xml
index 8c2029a..a145a58 100644
--- a/test/javaee6/pom.xml
+++ b/test/javaee6/pom.xml
@@ -63,5 +63,6 @@
<modules>
<module>disableFaceletToXhtmlMapping</module>
<module>xhtmlMappingToFaceletByDefault</module>
+ <module>facelets</module>
</modules>
</project>
@javaserverfaces Commented @ruolli said: submitted to 2.1.20 , commit d72a6ecb4d
@javaserverfaces Commented Issue-Links: is cloned by JAVASERVERFACES-4124
@javaserverfaces Commented This issue was imported from java.net JIRA JAVASERVERFACES-4127
@javaserverfaces Commented Marked as fixed on Thursday, April 14th 2016, 1:48:50 am
This is to track the backport of issue 4124 to 2.1.20 .
Affected Versions
[2.1.20-07]