You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Heath Borders-Wing (JIRA)" <in...@incubator.apache.org> on 2005/03/11 16:45:53 UTC

[jira] Commented: (MYFACES-129) Nested x:dataTable problem

     [ http://issues.apache.org/jira/browse/MYFACES-129?page=comments#action_60651 ]
     
Heath Borders-Wing commented on MYFACES-129:
--------------------------------------------

This is the same bug as MYFACES-38.

A fix has been submitted, it just needs to be committed to the source tree.

> Nested x:dataTable problem
> --------------------------
>
>          Key: MYFACES-129
>          URL: http://issues.apache.org/jira/browse/MYFACES-129
>      Project: MyFaces
>         Type: Bug
>     Versions: 1.0.8 beta
>  Environment: myfaces 1.0.9 , jboss 4.0.1sp1, tomcat 5.0.28, jre 1.5
>     Reporter: Grigoras Cristinel

>
> Hi,
> I have created this example to show the problem with x:dataTable.
> On submit the last value from last inner datatable is set to all other beans for other lines.
> Please help.
> Thanks
> <f:view>
> <h:form>
>    <x:dataTable var="lev1" value="#{test.list}">
>        <h:column>
>            <h:panelGrid columns="1">
>                <h:panelGrid columns="2">
>                    <x:inputText value="#{lev1.var1}" />
>                    <x:inputText value="#{lev1.var2}" />
>                </h:panelGrid>
>                <x:dataTable var="lev2" value="#{lev1.tableB}">
>                    <h:column>
>                        <h:panelGrid columns="2">
>                        <x:outputText value="Property A"/>
>                        <x:inputText value="#{lev2.propertyA}" />
>                        <x:outputText value="Property B"/> <x:inputText value="#{lev2.propertyB}" />
>                        <x:outputText value="Property C"/> <x:inputText value="#{lev2.propertyC}" />
>                        </h:panelGrid>
>                    </h:column>
>                </x:dataTable>
>            </h:panelGrid>
>        </h:column>
>        <f:facet name="footer">
>            <x:commandLink action="noneok" value="Submit">
>            </x:commandLink>
>        </f:facet>
>    </x:dataTable>
> </h:form>
> </f:view>
> /*
>  * Created on Mar 11, 2005
>  *
>  * TODO To change the template for this generated file go to
>  * Window - Preferences - Java - Code Style - Code Templates
>  */
> package ex2.test;
> import java.util.ArrayList;
> /**
>  * @author grig
>  *
>  * TODO To change the template for this generated type comment go to
>  * Window - Preferences - Java - Code Style - Code Templates
>  */
> public class SessionTable {
> 	private ArrayList list = new ArrayList();
> 	
> 	/**
> 	 * 
> 	 */
> 	public SessionTable() {
> 		super();
> 		list.add(new BeanTableA("Int1"));
> 		list.add(new BeanTableA("Int2"));
> 		
> 	}
> 	/**
> 	 * @return Returns the list.
> 	 */
> 	public ArrayList getList() {
> 		return list;
> 	}
> 	/**
> 	 * @param list The list to set.
> 	 */
> 	public void setList(ArrayList list) {
> 		this.list = list;
> 	}
> }
> /*
>  * Created on Mar 11, 2005
>  *
>  * TODO To change the template for this generated file go to
>  * Window - Preferences - Java - Code Style - Code Templates
>  */
> package ex2.test;
> import java.io.Serializable;
> /**
>  * @author grig
>  *
>  * TODO To change the template for this generated type comment go to
>  * Window - Preferences - Java - Code Style - Code Templates
>  */
> public class BeanTableB implements Serializable{
> 	private String propertyA = "";
> 	private String propertyB = "";
> 	private String propertyC = "";
> 		
> 	/**
> 	 * @param propertyA
> 	 * @param propertyB
> 	 * @param propertyC
> 	 */
> 	public BeanTableB(String propertyA, String propertyB, String propertyC) {
> 		super();
> 		this.propertyA = propertyA;
> 		this.propertyB = propertyB;
> 		this.propertyC = propertyC;
> 	}
> 	/**
> 	 * @return Returns the propertyA.
> 	 */
> 	public String getPropertyA() {
> 		return propertyA;
> 	}
> 	/**
> 	 * @param propertyA The propertyA to set.
> 	 */
> 	public void setPropertyA(String propertyA) {
> 		this.propertyA = propertyA;
> 	}
> 	/**
> 	 * @return Returns the propertyB.
> 	 */
> 	public String getPropertyB() {
> 		return propertyB;
> 	}
> 	/**
> 	 * @param propertyB The propertyB to set.
> 	 */
> 	public void setPropertyB(String propertyB) {
> 		this.propertyB = propertyB;
> 	}
> 	/**
> 	 * @return Returns the propertyC.
> 	 */
> 	public String getPropertyC() {
> 		return propertyC;
> 	}
> 	/**
> 	 * @param propertyC The propertyC to set.
> 	 */
> 	public void setPropertyC(String propertyC) {
> 		this.propertyC = propertyC;
> 	}
> }
> /*
>  * Created on Mar 11, 2005
>  *
>  * TODO To change the template for this generated file go to
>  * Window - Preferences - Java - Code Style - Code Templates
>  */
> package ex2.test;
> import java.io.Serializable;
> import java.util.ArrayList;
> /**
>  * @author grig
>  *
>  * TODO To change the template for this generated type comment go to
>  * Window - Preferences - Java - Code Style - Code Templates
>  */
> public class BeanTableA implements Serializable {
> 	
> 	private ArrayList tableB = new ArrayList();
> 	private String var1 = "";
> 	private String var2 ="";
> 	
> 	/**
> 	 * 
> 	 */
> 	public BeanTableA(String poz) {
> 		super();
> 		var1 = poz+":var1";
> 		var2 = poz+":var2";
> 		tableB.add(new BeanTableB(poz+":B1L1C1",poz+":B1L1C2",poz+":B1L1C3"));
> 		tableB.add(new BeanTableB(poz+":B1L2C1",poz+":B1L2C2",poz+":B1L2C3"));
> 	}
> 	/**
> 	 * @return Returns the table2.
> 	 */
> 	public ArrayList getTableB() {
> 		return tableB;
> 	}
> 	/**
> 	 * @param table2 The table2 to set.
> 	 */
> 	public void setTableB(ArrayList tableB) {
> 		this.tableB = tableB;
> 	}
> 	/**
> 	 * @return Returns the var1.
> 	 */
> 	public String getVar1() {
> 		return var1;
> 	}
> 	/**
> 	 * @param var1 The var1 to set.
> 	 */
> 	public void setVar1(String var1) {
> 		this.var1 = var1;
> 	}
> 	/**
> 	 * @return Returns the var2.
> 	 */
> 	public String getVar2() {
> 		return var2;
> 	}
> 	/**
> 	 * @param var2 The var2 to set.
> 	 */
> 	public void setVar2(String var2) {
> 		this.var2 = var2;
> 	}
> }
> <?xml version="1.0"?>
> <!DOCTYPE faces-config PUBLIC
>   "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
>   "http://java.sun.com/dtd/web-facesconfig_1_0.dtd" >
> <faces-config>
> 	
> 	<!-- managed beans of the simple hello world app -->
> 	<managed-bean>
> 		<managed-bean-name>test</managed-bean-name>
> 		<managed-bean-class>ex2.test.SessionTable</managed-bean-class>
> 		<managed-bean-scope>session</managed-bean-scope>
> 	</managed-bean>
> 	
> 	<!-- navigation rules for helloWorld.jsp -->
> 	<navigation-rule>
> 		<from-view-id>/helloWorld.jsp</from-view-id>
> 		<navigation-case>
> 			<from-outcome>success</from-outcome>
> 			<to-view-id>/page2.jsp</to-view-id>
> 		</navigation-case>
> 	</navigation-rule>
> 	
> 	<!-- navigation rules for page2.jsp -->
> 	<navigation-rule>
> 		<from-view-id>/page2.jsp</from-view-id>
> 		<navigation-case>
> 			<from-outcome>back</from-outcome>
> 			<to-view-id>/helloWorld.jsp</to-view-id>
> 		</navigation-case>
> 	</navigation-rule>
> </faces-config>
> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
> <%@ taglib uri="http://myfaces.apache.org/extensions" prefix="x"%>
> <html>
> <HEAD>
> <TITLE>Test inner data table </TITLE>
> </HEAD>
> <BODY>
> <f:view>
> <h:form>
> 	<x:dataTable var="lev1" value="#{test.list}">
> 		<h:column>
> 			<h:panelGrid columns="1">
> 				<h:panelGrid columns="2">
> 					<x:inputText value="#{lev1.var1}" />
> 					<x:inputText value="#{lev1.var2}" />
> 				</h:panelGrid>
> 				<x:dataTable var="lev2" value="#{lev1.tableB}">
> 					<h:column>
> 						<h:panelGrid columns="2">
> 						<x:outputText value="Property A"/>
> 						<x:inputText value="#{lev2.propertyA}" />
> 						<x:outputText value="Property B"/>						
> 						<x:inputText value="#{lev2.propertyB}" />
> 						<x:outputText value="Property C"/>						
> 						<x:inputText value="#{lev2.propertyC}" />
> 						</h:panelGrid>
> 					</h:column>
> 				</x:dataTable>
> 			</h:panelGrid>
> 		</h:column>
> 		<f:facet name="footer">
> 			<x:commandLink action="noneok" value="Submit">
> 			</x:commandLink>
> 		</f:facet>
> 	</x:dataTable>
> </h:form>
> </f:view>
> </BODY>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira