• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Datatable trying to access non-existent field from Bean

Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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">
<h:outputText value="UM02" />
<h:commandLink action="UM03">
<h:outputText 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">
<h:outputText value="Back Home"></h:outputText>

    Bookmark Topic Watch Topic
  • New Topic