This repository has been archived by the owner on Mar 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://github.com/javaserverfaces/mojarra/issues/4103 The parameter is not passed to h:commandButton defined as composite component modified: jsf-ri/src/main/java/com/sun/faces/application/view/FaceletViewHandlingStrategy.java new file: test/javaee6web/facelets/src/main/java/com/sun/faces/test/javaee6web/facelets/Issue4073Bean.java new file: test/javaee6web/facelets/src/main/webapp/WEB-INF/template/template.xhtml new file: test/javaee6web/facelets/src/main/webapp/WEB-INF/xhtml/parts.xhtml new file: test/javaee6web/facelets/src/main/webapp/issue4073.xhtml new file: test/javaee6web/facelets/src/main/webapp/resources/t/comp.xhtml new file: test/javaee6web/facelets/src/test/java/com/sun/faces/test/javaee6web/facelets/Issue4073IT.java
- Loading branch information
1 parent
f55bb27
commit e8bd403
Showing
7 changed files
with
212 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...vaee6web/facelets/src/main/java/com/sun/faces/test/javaee6web/facelets/Issue4073Bean.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.sun.faces.test.javaee6web.facelets; | ||
|
||
import java.io.Serializable; | ||
|
||
import javax.enterprise.context.SessionScoped; | ||
import javax.inject.Named; | ||
|
||
@Named("sampleMBean") | ||
@SessionScoped | ||
public class Issue4073Bean implements Serializable { | ||
private String button2SetValue; | ||
|
||
public String getButton2SetValue() { | ||
return button2SetValue; | ||
} | ||
|
||
public void setButton2SetValue(String button2SetValue) { | ||
this.button2SetValue = button2SetValue; | ||
} | ||
|
||
public void initialize() { | ||
System.out.println("# called initialize()"); | ||
} | ||
|
||
public String button1() { | ||
System.out.println("# called button1()"); | ||
return null; | ||
} | ||
|
||
public String button2(String value) { | ||
System.out.println("# called button2() value=" + value); | ||
button2SetValue = value; | ||
return null; | ||
} | ||
|
||
public String getText() { | ||
return "Hello World"; | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
test/javaee6web/facelets/src/main/webapp/WEB-INF/template/template.xhtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version='1.0' encoding='UTF-8' ?> | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" | ||
xmlns:c="http://java.sun.com/jsp/jstl/core" | ||
xmlns:f="http://java.sun.com/jsf/core" | ||
xmlns:h="http://java.sun.com/jsf/html" | ||
xmlns:ui="http://java.sun.com/jsf/facelets" | ||
xmlns:t="http://java.sun.com/jsf/composite/t"> | ||
|
||
<h:head> | ||
</h:head> | ||
<h:body> | ||
<f:view> | ||
<f:event type="preRenderView" listener="#{managedBean.initialize}" /> | ||
<h:form prependId="false"> | ||
<ui:insert name="content"></ui:insert> | ||
<h:outputText id="button2value" value="#{managedBean.button2SetValue}"> | ||
</h:outputText> | ||
</h:form> | ||
|
||
</f:view> | ||
</h:body> | ||
</html> |
13 changes: 13 additions & 0 deletions
13
test/javaee6web/facelets/src/main/webapp/WEB-INF/xhtml/parts.xhtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version='1.0' encoding='UTF-8' ?> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<ui:composition xmlns="http://www.w3.org/1999/xhtml" | ||
xmlns:f="http://java.sun.com/jsf/core" | ||
xmlns:h="http://java.sun.com/jsf/html" | ||
xmlns:ui="http://java.sun.com/jsf/facelets" | ||
xmlns:c="http://java.sun.com/jsp/jstl/core" | ||
xmlns:t="http://java.sun.com/jsf/composite/t"> | ||
|
||
<t:comp id="comp_id" value="#{param2}" action1="#{managedBean.button2(param3)}" /> | ||
<br /> | ||
|
||
</ui:composition> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version='1.0' encoding='UTF-8' ?> | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" | ||
xmlns:f="http://java.sun.com/jsf/core" | ||
xmlns:h="http://java.sun.com/jsf/html" | ||
xmlns:ui="http://java.sun.com/jsf/facelets" | ||
xmlns:c="http://java.sun.com/jsp/jstl/core" | ||
xmlns:t="http://java.sun.com/jsf/composite/t"> | ||
|
||
<ui:composition template="/WEB-INF/template/template.xhtml"> | ||
|
||
<f:metadata> | ||
<ui:param name="managedBean" value="#{sampleMBean}" /> | ||
</f:metadata> | ||
|
||
<ui:define name="content"> | ||
<ui:decorate template="/WEB-INF/xhtml/parts.xhtml"> | ||
<ui:param name="managedBean" value="#{managedBean}" /> | ||
<ui:param name="param1" value="TEST 1" /> | ||
<ui:param name="param2" value="TEST 2" /> | ||
<ui:param name="param3" value="#{managedBean.text}" /> | ||
</ui:decorate> | ||
</ui:define> | ||
|
||
</ui:composition> | ||
</html> |
22 changes: 22 additions & 0 deletions
22
test/javaee6web/facelets/src/main/webapp/resources/t/comp.xhtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version='1.0' encoding='UTF-8' ?> | ||
<html xmlns="http://www.w3.org/1999/xhtml" | ||
xmlns:f="http://java.sun.com/jsf/core" | ||
xmlns:h="http://java.sun.com/jsf/html" | ||
xmlns:ui="http://java.sun.com/jsf/facelets" | ||
xmlns:c="http://java.sun.com/jsp/jstl/core" | ||
xmlns:composite="http://java.sun.com/jsf/composite"> | ||
|
||
<composite:interface> | ||
|
||
<composite:attribute name="action1" shortDescription="action1" method-signature="java.lang.String action()" /> | ||
<composite:attribute name="value" shortDescription="value" /> | ||
|
||
</composite:interface> | ||
|
||
<composite:implementation> | ||
|
||
<h:commandButton id="Button_id" value="#{cc.attrs.value}" action="#{cc.attrs.action1}" /> | ||
|
||
</composite:implementation> | ||
|
||
</html> |
79 changes: 79 additions & 0 deletions
79
...javaee6web/facelets/src/test/java/com/sun/faces/test/javaee6web/facelets/Issue4073IT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | ||
* | ||
* Copyright (c) 1997-2013 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.javaee6web.facelets; | ||
|
||
import com.gargoylesoftware.htmlunit.WebClient; | ||
import com.gargoylesoftware.htmlunit.html.HtmlPage; | ||
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput; | ||
import com.gargoylesoftware.htmlunit.html.HtmlTextInput; | ||
import com.sun.faces.test.junit.JsfTestRunner; | ||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import static org.junit.Assert.*; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(JsfTestRunner.class) | ||
public class Issue4073IT { | ||
|
||
private String webUrl; | ||
private WebClient webClient; | ||
|
||
@Before | ||
public void setUp() { | ||
webUrl = System.getProperty("integration.url"); | ||
webClient = new WebClient(); | ||
} | ||
|
||
@After | ||
public void tearDown() { | ||
webClient.closeAllWindows(); | ||
} | ||
|
||
@Test | ||
public void testButton2SetValueNotNull() throws Exception { | ||
HtmlPage page = webClient.getPage(webUrl + "faces/issue4073.xhtml"); | ||
HtmlSubmitInput button = (HtmlSubmitInput) page.getElementById("comp_id:Button_id"); | ||
page = button.click(); | ||
|
||
assertTrue(page.asText().contains("Hello World")); | ||
} | ||
|
||
} |