Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Invalid
-
1.0.9m9
-
None
-
None
-
Windows XP, Jboss 3.2.6, Internet Explorer
Description
I have page.jsp with datatable and a button:
<x:dataTable id="listarodzajepism" value="#
{listRodzajePism.rodzajePism}"
var="rodzajPisma" border="0"
styleClass="standardTable"
headerClass="standardTable_SortHeader"
rowClasses="standardTable_Row1,standardTable_Row2"
footerClass="standardTable_Footer"
sortColumn="#
"
sortAscending="#
"
preserveDataModel="true"
preserveSort="true"
rows="24"
binding="#
... column, column, column ...
</x:dataTable>
<h:commandButton id="cb" value="NewPage" action="newpage"/>
Action "newpage" of commandbutton opens page2.jsp with only one button:
<h:commandButton id="button"
value="Cancel"
action="back"
immediate="true"/>
Action "back" goes back to page.jsp. And here the problem occurs becuase I receive an error:
javax.faces.FacesException: Could not get property rows of component
rodzajepismview:listarodzajepism Caused by:
java.lang.NullPointerException
at
org.apache.myfaces.component.html.ext.HtmlDataTable.getRows(HtmlDataTable.java:547)
When I open page.jsp everything is OK, but action page.jsp -> page2.jsp -> page.jsp cause an error.
In my backing bean I have:
private HtmlDataTable jsfDataTable;
public HtmlDataTable getJsfDataTable() { return jsfDataTable; }
public void setJsfDataTable(HtmlDataTable jsfDataTable) { this.jsfDataTable = jsfDataTable; }
Backing bean is session scoped. When binding="#{listRodzajePism.jsfDataTable}
" is removed from x:datatable tag, everyhing works just fine.
I spent some time debugging and here are the results:
Exception is thrown in getRows() method of org.apache.myfaces.component.html.ext.HtmlDataTable when command
return ((_SerializableDataModel)_dataModel).getRows();
is invoked. Cause of exception: _dataModel is null. This line is invoked only when _isDataModelRestored = true. I checked that when I open page2.jsp _dataModel is created and _isDataModelRestored is set to true. But when I return to page1.jsp from page2.jsp, setValueBinding method is invoked and _dataModel is set to null. But _isDataModelRestored is still true.