You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by or...@apache.org on 2005/02/16 03:07:25 UTC
cvs commit: incubator-myfaces/src/jsfapi/javax/faces/component UIForm.java
oros 2005/02/15 18:07:25
Modified: src/cactus/web/WEB-INF/beans additional-beans.xml
src/jsfapi/javax/faces/component UIForm.java
Added: src/cactus/org/apache/myfaces/cactus ArticleThreadMBean.java
ArticleThreadTableMBean.java
src/cactus/web Bug1050022CactusTest.jsp
Log:
SF issue #1050022: support forms used within a datatable
Revision Changes Path
1.1 incubator-myfaces/src/cactus/org/apache/myfaces/cactus/ArticleThreadMBean.java
Index: ArticleThreadMBean.java
===================================================================
package org.apache.myfaces.cactus;
import java.util.ArrayList;
import java.util.List;
public class ArticleThreadMBean {
private String title;
private String replyTitle;
private String result;
private ArticleThreadTableMBean parent;
void setParent(ArticleThreadTableMBean parent) {
this.parent = parent;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
replyTitle = "Re: " + title;
}
public void setReplyTitle(String replyTitle) {
this.replyTitle = replyTitle;
}
public String getReplyTitle() {
return replyTitle;
}
public String reply() {
parent.setResult(replyTitle);
return "";
}
}
1.1 incubator-myfaces/src/cactus/org/apache/myfaces/cactus/ArticleThreadTableMBean.java
Index: ArticleThreadTableMBean.java
===================================================================
package org.apache.myfaces.cactus;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
public class ArticleThreadTableMBean {
private String result;
public List getArticleThreadTable() {
List ret = new ArrayList();
ArticleThreadMBean thread = new ArticleThreadMBean();
thread.setTitle("First Title");
thread.setParent(this);
ret.add(thread);
thread = new ArticleThreadMBean();
thread.setTitle("Second Title");
thread.setParent(this);
ret.add(thread);
return Collections.unmodifiableList(ret);
}
void setResult(String result) {
this.result = result;
}
public String getResult() {
return result;
}
}
1.4 +7 -0 incubator-myfaces/src/cactus/web/WEB-INF/beans/additional-beans.xml
Index: additional-beans.xml
===================================================================
RCS file: /home/cvs/incubator-myfaces/src/cactus/web/WEB-INF/beans/additional-beans.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- additional-beans.xml 16 Feb 2005 01:04:41 -0000 1.3
+++ additional-beans.xml 16 Feb 2005 02:07:24 -0000 1.4
@@ -52,3 +52,10 @@
</map-entries>
</managed-property>
</managed-bean>
+
+ <managed-bean>
+ <description>Bug 1050022</description>
+ <managed-bean-name>ArticleThreadTable</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.cactus.ArticleThreadTableMBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
1.1 incubator-myfaces/src/cactus/web/Bug1050022CactusTest.jsp
Index: Bug1050022CactusTest.jsp
===================================================================
<%@ page contentType="text/html; charset=Shift_JIS" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<f:view>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<link REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
<TITLE>Hello</TITLE>
</HEAD>
<BODY BGCOLOR="white">
<BR>
<BR>
<h:dataTable width="100%" value="#{ArticleThreadTable.articleThreadTable}"
var="thread" border="0">
<h:column>
<h:form id="replyForm">
<h:outputText value="#{thread.title}"/><f:verbatim>:</f:verbatim>
<h:inputText id="replyTitle" required="true" size="80" value="#{thread.replyTitle}"/>
<h:message styleClass="ErrorMessage" showSummary="true" for="replyTitle"/>
<h:commandButton action="#{thread.reply}"/>
<f:verbatim><BR></f:verbatim>
</h:form>
</h:column>
</h:dataTable>
Selected:<h:outputText value="#{ArticleThreadTable.result}"/>
</BODY>
</HTML>
</f:view>
1.9 +10 -2 incubator-myfaces/src/jsfapi/javax/faces/component/UIForm.java
Index: UIForm.java
===================================================================
RCS file: /home/cvs/incubator-myfaces/src/jsfapi/javax/faces/component/UIForm.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- UIForm.java 1 Jul 2004 22:00:49 -0000 1.8
+++ UIForm.java 16 Feb 2005 02:07:25 -0000 1.9
@@ -55,6 +55,10 @@
public void processValidators(javax.faces.context.FacesContext context)
{
if (context == null) throw new NullPointerException("context");
+ // SF issue #1050022: a form used within a datatable will loose it's submitted state
+ // as UIForm is no EditableValueHolder and therefore it's state is not saved/restored by UIData
+ // to restore the submitted state we call decode here again
+ decode(context);
if (!isSubmitted()) return;
for (Iterator it = getFacetsAndChildren(); it.hasNext(); )
{
@@ -66,6 +70,10 @@
public void processUpdates(javax.faces.context.FacesContext context)
{
if (context == null) throw new NullPointerException("context");
+ // SF issue #1050022: a form used within a datatable will loose it's submitted state
+ // as UIForm is no EditableValueHolder and therefore it's state is not saved/restored by UIData
+ // to restore the submitted state we call decode here again
+ decode(context);
if (!isSubmitted()) return;
for (Iterator it = getFacetsAndChildren(); it.hasNext(); )
{