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 2010/05/10 21:42:02 UTC
svn commit: r942868 - in /myfaces/current20/test-webapp/webapp/src/main:
java/org/apache/myfaces/commandParams/ webapp/ webapp/WEB-INF/
Author: lu4242
Date: Mon May 10 19:42:01 2010
New Revision: 942868
URL: http://svn.apache.org/viewvc?rev=942868&view=rev
Log:
MYFACES-2704 <f:param> in <h:commandButton> not rendered properly
Added:
myfaces/current20/test-webapp/webapp/src/main/java/org/apache/myfaces/commandParams/
myfaces/current20/test-webapp/webapp/src/main/java/org/apache/myfaces/commandParams/CommandParamBean.java
myfaces/current20/test-webapp/webapp/src/main/webapp/checkScriptCommandLink.xhtml
myfaces/current20/test-webapp/webapp/src/main/webapp/checkScriptInline.xhtml
myfaces/current20/test-webapp/webapp/src/main/webapp/commandParams.xhtml
Modified:
myfaces/current20/test-webapp/webapp/src/main/webapp/WEB-INF/faces-config.xml
myfaces/current20/test-webapp/webapp/src/main/webapp/home.xhtml
Added: myfaces/current20/test-webapp/webapp/src/main/java/org/apache/myfaces/commandParams/CommandParamBean.java
URL: http://svn.apache.org/viewvc/myfaces/current20/test-webapp/webapp/src/main/java/org/apache/myfaces/commandParams/CommandParamBean.java?rev=942868&view=auto
==============================================================================
--- myfaces/current20/test-webapp/webapp/src/main/java/org/apache/myfaces/commandParams/CommandParamBean.java (added)
+++ myfaces/current20/test-webapp/webapp/src/main/java/org/apache/myfaces/commandParams/CommandParamBean.java Mon May 10 19:42:01 2010
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+*/
+package org.apache.myfaces.commandParams;
+
+import javax.annotation.PostConstruct;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * A typical simple backing bean, that is backed to <code>helloworld.jsp</code>
+ *
+ * @author <a href="mailto:matzew@apache.org">Matthias WeÃendorf</a>
+ */
+public class CommandParamBean {
+
+ private static Log log = LogFactory.getLog(CommandParamBean.class);
+
+ private String greeting;
+
+ private String param1;
+
+ public CommandParamBean()
+ {
+ greeting = "Hello";
+ }
+
+ @PostConstruct
+ public void init()
+ {
+ FacesContext context = FacesContext.getCurrentInstance();
+ ExternalContext ex = context.getExternalContext();
+
+ if (ex != null &&
+ ex.getRequestParameterMap() != null &&
+ ex.getRequestParameterMap().containsKey("param1")) {
+ setParam1((String)ex.getRequestParameterMap().get("param1"));
+ }
+ }
+
+ public String getGreeting()
+ {
+ return greeting;
+ }
+
+ public void setGreeting(String greeting)
+ {
+ this.greeting = greeting;
+ }
+
+
+ public String getParam1()
+ {
+ return param1;
+ }
+
+ public void setParam1(String param1)
+ {
+ this.param1 = param1;
+ }
+
+ public void updateGreeting(ActionEvent evt)
+ {
+ greeting = "Bye!";
+ }
+}
\ No newline at end of file
Modified: myfaces/current20/test-webapp/webapp/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/current20/test-webapp/webapp/src/main/webapp/WEB-INF/faces-config.xml?rev=942868&r1=942867&r2=942868&view=diff
==============================================================================
--- myfaces/current20/test-webapp/webapp/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/current20/test-webapp/webapp/src/main/webapp/WEB-INF/faces-config.xml Mon May 10 19:42:01 2010
@@ -220,6 +220,11 @@
<managed-bean-class>org.apache.myfaces.selectItem.SelectItemEscapeBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>commandParamBean</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.commandParams.CommandParamBean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
<!-- navigation rules for helloWorld.xhtml -->
<navigation-rule>
<from-view-id>/helloWorld.xhtml</from-view-id>
Added: myfaces/current20/test-webapp/webapp/src/main/webapp/checkScriptCommandLink.xhtml
URL: http://svn.apache.org/viewvc/myfaces/current20/test-webapp/webapp/src/main/webapp/checkScriptCommandLink.xhtml?rev=942868&view=auto
==============================================================================
--- myfaces/current20/test-webapp/webapp/src/main/webapp/checkScriptCommandLink.xhtml (added)
+++ myfaces/current20/test-webapp/webapp/src/main/webapp/checkScriptCommandLink.xhtml Mon May 10 19:42:01 2010
@@ -0,0 +1,20 @@
+<?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">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:composite="http://java.sun.com/jsf/composite"
+ >
+<h:head>
+</h:head>
+<h:body>
+ <h:form id="form1">
+ <h:panelGrid id="grid1" columns="2">
+ <h:outputText value="The following link should render automatically jsf.js script:"/>
+ <h:commandLink value="Update greeting" onclick="somevar=1">
+ </h:commandLink>
+ </h:panelGrid>
+ </h:form>
+</h:body>
+</html>
\ No newline at end of file
Added: myfaces/current20/test-webapp/webapp/src/main/webapp/checkScriptInline.xhtml
URL: http://svn.apache.org/viewvc/myfaces/current20/test-webapp/webapp/src/main/webapp/checkScriptInline.xhtml?rev=942868&view=auto
==============================================================================
--- myfaces/current20/test-webapp/webapp/src/main/webapp/checkScriptInline.xhtml (added)
+++ myfaces/current20/test-webapp/webapp/src/main/webapp/checkScriptInline.xhtml Mon May 10 19:42:01 2010
@@ -0,0 +1,22 @@
+<?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">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:composite="http://java.sun.com/jsf/composite"
+ >
+<head>
+</head>
+<body>
+ <h:form id="form1">
+ <h:messages/>
+ <h:panelGrid id="grid1" columns="2">
+ <h:outputText value="The following link should render automatically jsf.js script:"/>
+ <h:inputText value="Update greeting" onmouseover="this.style.background='red'">
+ <f:ajax event="click" render="grid1"/>
+ </h:inputText>
+ </h:panelGrid>
+ </h:form>
+</body>
+</html>
\ No newline at end of file
Added: myfaces/current20/test-webapp/webapp/src/main/webapp/commandParams.xhtml
URL: http://svn.apache.org/viewvc/myfaces/current20/test-webapp/webapp/src/main/webapp/commandParams.xhtml?rev=942868&view=auto
==============================================================================
--- myfaces/current20/test-webapp/webapp/src/main/webapp/commandParams.xhtml (added)
+++ myfaces/current20/test-webapp/webapp/src/main/webapp/commandParams.xhtml Mon May 10 19:42:01 2010
@@ -0,0 +1,47 @@
+<?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">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:composite="http://java.sun.com/jsf/composite"
+ >
+<h:head>
+</h:head>
+<h:body>
+ <h:form id="form1">
+ <h:panelGrid id="grid1" columns="2">
+ <h:outputText value="#{commandParamBean.greeting}"/>
+ <h:commandButton value="Update greeting" actionListener="#{commandParamBean.updateGreeting}">
+ <f:param name="param1" value="value1"/>
+ </h:commandButton>
+ </h:panelGrid>
+ </h:form>
+ <h:form id="form2">
+ <h:panelGrid id="grid2" columns="2">
+ <h:outputText value="#{commandParamBean.greeting}"/>
+ <h:commandButton value="Update greeting" actionListener="#{commandParamBean.updateGreeting}">
+ <f:param name="param1" value="value2"/>
+ </h:commandButton>
+ </h:panelGrid>
+ </h:form>
+ <h:form id="form3">
+ <h:panelGrid id="grid3" columns="2">
+ <h:outputText value="#{commandParamBean.greeting}"/>
+ <h:commandButton value="Update greeting" actionListener="#{commandParamBean.updateGreeting}">
+ <f:param name="param1" value="value1"/>
+ </h:commandButton>
+ <h:outputText value="#{commandParamBean.greeting}"/>
+ <h:commandButton value="Update greeting" actionListener="#{commandParamBean.updateGreeting}">
+ <f:param name="param1" value="value2"/>
+ </h:commandButton>
+ </h:panelGrid>
+ </h:form>
+
+
+ <h:panelGrid id="grid" columns="2">
+ <h:outputLabel for="showParam1" value="Parameter 1"/>
+ <h:outputText id="showParam1" value="#{commandParamBean.param1}"/>
+ </h:panelGrid>
+</h:body>
+</html>
\ No newline at end of file
Modified: myfaces/current20/test-webapp/webapp/src/main/webapp/home.xhtml
URL: http://svn.apache.org/viewvc/myfaces/current20/test-webapp/webapp/src/main/webapp/home.xhtml?rev=942868&r1=942867&r2=942868&view=diff
==============================================================================
--- myfaces/current20/test-webapp/webapp/src/main/webapp/home.xhtml (original)
+++ myfaces/current20/test-webapp/webapp/src/main/webapp/home.xhtml Mon May 10 19:42:01 2010
@@ -37,6 +37,9 @@
<h:outputLink value="ajax4n.jsf">
<h:outputText value="Ajax 4" />
</h:outputLink>
+ <h:outputLink value="commandParams.jsf">
+ <h:outputText value="h:commandButton with f:param" />
+ </h:outputLink>
</h:panelGrid>
</h:form>