You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Paweł Kołoszko (JIRA)" <my...@incubator.apache.org> on 2005/08/19 14:55:55 UTC

[jira] Created: (MYFACES-431) NullPointerException when binding HtmlDataTable to backing bean

NullPointerException when binding HtmlDataTable to backing bean
---------------------------------------------------------------

         Key: MYFACES-431
         URL: http://issues.apache.org/jira/browse/MYFACES-431
     Project: MyFaces
        Type: Bug
  Components: Tomahawk  
    Versions: 1.0.9 beta    
 Environment: Windows XP, Jboss 3.2.6, Internet Explorer
    Reporter: Paweł Kołoszko
    Priority: Critical


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="#{listRodzajePism.sort}"
 sortAscending="#{listRodzajePism.ascending}"
                 preserveDataModel="true"
               preserveSort="true"
                 rows="24"
 binding="#{listRodzajePism.jsfDataTable}">

... 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.


-- 
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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (MYFACES-431) NullPointerException when binding HtmlDataTable to backing bean

Posted by "Mathias Broekelmann (JIRA)" <my...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/MYFACES-431?page=all ]
     
Mathias Broekelmann closed MYFACES-431:
---------------------------------------

    Fix Version: Nightly Build
     Resolution: Invalid

I close this issue since it is related to an old implementation of UIData (1.0.9).
We can reopen this issue if the problem still exists with the current nightly.

> NullPointerException when binding HtmlDataTable to backing bean
> ---------------------------------------------------------------
>
>          Key: MYFACES-431
>          URL: http://issues.apache.org/jira/browse/MYFACES-431
>      Project: MyFaces
>         Type: Bug
>   Components: Tomahawk
>     Versions: 1.0.9 beta
>  Environment: Windows XP, Jboss 3.2.6, Internet Explorer
>     Reporter: Pawe? Ko?oszko
>     Assignee: Mathias Broekelmann
>     Priority: Critical
>      Fix For: Nightly Build

>
> 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="#{listRodzajePism.sort}"
>  sortAscending="#{listRodzajePism.ascending}"
>                  preserveDataModel="true"
>                preserveSort="true"
>                  rows="24"
>  binding="#{listRodzajePism.jsfDataTable}">
> ... 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.

-- 
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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira