title: javax.el.ELException: java.lang.NullPointerException
body: <p>I use primefaces single row selection data table , and i want to change a value on the selected row so this is my xhtml page</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;h:form id="form"&gt;
      &lt;p:panel header="Prix des matériaux " style="width : 664px; " &gt;  
          &lt;br /&gt;
          &lt;p:dataTable id="cars" var="car" value="#{materielbean.listitemsmaterielBean}"
              rowKey="#{car.iditemsmateriel}"  paginator="true" rows="20"  
              selection="#{materielbean.selecteditemforprix}" selectionMode="single" &gt; 
              &lt;p:ajax event="rowSelect"  update=":form:dialog" oncomplete="PF('carDialog').show()"/&gt;  
              &lt;f:facet name="header"&gt;  
                  Liste de de matériel  
              &lt;/f:facet&gt;  
              &lt;p:column headerText="Désignation" filterBy="designation"  &gt;  
                  #{car.designation}  
              &lt;/p:column&gt;  
              &lt;p:column headerText="Unité"&gt;  
                  #{car.unite}  
              &lt;/p:column&gt;  
              &lt;p:column headerText="Prix en DT" &gt;  
                #{car.prix} 
              &lt;/p:column&gt;
          &lt;/p:dataTable&gt;  
  
          &lt;p:dialog id="dialog" header="Changer le prix d'un article" widgetVar="carDialog"
              resizable="true" showEffect="fade" hideEffect="explode"&gt;  
              &lt;h:panelGrid columns="3"&gt;         
                  &lt;h:outputText value=" #{materielbean.selecteditemforprix.designation}" /&gt; 
                  &lt;p:inputText value="#{materielbean.selecteditemforprix.prix}"/&gt;
                  &lt;p:commandButton value="OK"  action="#{materielbean.modifprixofitem()}"
                      onclick="PF('carDialog').hide()" update=":form:cars"   /&gt;
              &lt;/h:panelGrid&gt;
          &lt;/p:dialog&gt;  
      &lt;/p:panel&gt;  
  &lt;/h:form&gt;
  </code></pre>
  
  <p>And this is the backing bean to modify the selected object</p>
  
  <pre><code>@ManagedBean(name="materielBean")
  @SessionScoped
      private ItemsMateriel selecteditemforprix;
  
      public ItemsMateriel getSelecteditemforprix() {
          return selecteditemforprix;
      }
  
      public void setSelecteditemforprix(ItemsMateriel selecteditemforprix) {
          this.selecteditemforprix = selecteditemforprix;
      }
  
  
      public void modifprixofitem() {
          itemmaterielDAO.Modifitemsmateriel(selecteditemforprix );
          selecteditemforprix = new ItemsMateriel();  
      }
  </code></pre>
  
  <p>When I click "OK" I take the new value from the inputtext, update my object in the database and finally I update the data table, but when I did it like that, I got an error which says</p>
  
  <pre><code>22:16:48,999 GRAVE [javax.enterprise.resource.webcontainer.jsf.context] (http-localhost-127.0.0.1-8383-6) javax.el.ELException: /Gestionstock/Materiel/Matos.xhtml @28,97 rowKey="#{car.iditemsmateriel}": java.lang.NullPointerException
  </code></pre>