Datatable Binding Affecting Display upon Navigaion
fischman_98 Feb 6, 2008 7:16 PMI have a <t:dataTable> that is bound to rows data and <t:columns> bound to column data (I did it this way to allow for dynamic columns - in this case 3x3). I have a navigation rule from page 1 to page 2. The datatable's on each page bind to the same backing bean property.
Page 1 is displaying links, when clicked go to Page 2. The problem is the data displayed on Page 1 is ALSO being displayed on Page 2 in addition to the page 2 data. I simplified the code to not retrieve any data from the backing bean...simply outputting an X link on Page 1 and Y on Page 2.
So Page 1 displays:
X X X
X X X
X X X
and Page 2 displays:
YX YX YX
YX YX YX
YX YX YX
I also had to put an id tag on Page 2 t:outputText. Page 2 should obviously only display Y.
Any thoughts?
Here's the code:
Page 1:
<%@ 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/tomahawk" prefix="t"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<html>
<head>
<title></title>
</head>
<body>
<f:view>
<h:form style="margin: 0 auto; padding: 0; width: 521px;">
<t:dataTable var="testrows" value="#{exploreBean.dataModel}"
rows="#{exploreBean.rowsPerPage}"
binding="#{exploreBean.rowsData}">
<t:columns value="#{exploreBean.columns}" var="testcols"
binding="#{exploreBean.columnsData}">
<t:commandLink action="success">
<t:outputText value="X" />
</t:commandLink>
</t:columns>
</t:dataTable>
</h:form>
</f:view>
</body>
</html>Page 2:
<%@ 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/tomahawk" prefix="t"%>
<html>
<head>
<title></title>
</head>
<body>
<f:view>
<t:outputText value="Test 2"></t:outputText>
<h:form style="margin: 0 auto; padding: 0; width: 521px;">
<t:dataTable var="yrows" value="#{exploreBean.dataModel}"
rows="#{exploreBean.rowsPerPage}"
binding="#{exploreBean.rowsData}">
<t:columns value="#{exploreBean.columns}" var="cols"
binding="#{exploreBean.columnsData}">
<t:outputText id="y" value="Y" />
</t:columns>
</t:dataTable>
</h:form>
</f:view>
</body>
</html>[/img]