• Post Reply Bookmark Topic Watch Topic
  • New Topic

Datatable trying to access non-existent field from Bean  RSS feed

Ayan Afridi
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having a very strange problem in JSF. I currently have one links page with four commandLinks in it, and one JSF page witha datatable in it, and an IBM <hx:pagerDeluxe> in it to page through the data. Each command link fires off a different action, as shown below:

{code}<h:commandLink action="UM02">
<hutputText value="UM02" />
<h:commandLink action="UM03">
<hutputText value="UM03" />
..........etc ........

My Navigation rules all point to one JSP file, but with a different param appended to the URL:

So as you can see, I have one JSF file to display a list from any given table name. I also dynamically populate the dataTable through my code, by reading through a list of columns for each table, and creating a "UIColumn":

{code}while( itr.hasNext() ){

String fieldName = (String) itr.next();
ValueBinding vb = FacesContext.getCurrentInstance().getApplication().createValueBinding("#{var." + fieldName + "}");
HtmlOutputText header = new HtmlOutputText();
UIColumn col = new UIColumn();
UIOutput out = new UIOutput();
out.setValueBinding("value", vb);
col.setHeader( header );

And that dataTable is shown in the JSF page. So i can go back to the main links page, click on another table name, and it will populate the datatable with the correct columns, data, etc. The problem happens when I go to one table, say UM02, and hit ">" on the pager, to go to the next page, which works, THEN i go back to the links page, and hit "UM03" and the first page displays fine. When I try to go to the next page, I get an error saying that the backing bean UM03Bean does not have field "subProductCd". Basically, values from the old dataTable objects are being used for smoe reason when I page. Not sure why this is happening.

My datatable is defined like this:

{code}<h:form id="dataTableForm"><h:dataTable id="dataTable1" border="0" cellpadding="2"
cellspacing="0" columnClasses="columnClass1"
headerClass="headerClass" footerClass="footerClass"
rowClasses="rowClass1, rowClass2, rowClass3"
styleClass="dataTableEx" width="70%" rows="10"
value="#{TestAction.list}" var="var"

<f:facet name="footer">
<hx:panelBox styleClass="panelBox" id="pagerbox">
<hx:pagerDeluxe styleClass="pagerDeluxe" id="deluxe1" for="dataTable1"/>
<h:commandLink action="home">
<hutputText value="Back Home"></hutputText>

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!