简体   繁体   English

javax.el.E​​LException:java.lang.NullPointerException

[英]javax.el.ELException: java.lang.NullPointerException

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 我使用primefaces单行选择数据表,并且我想更改所选行的值,所以这是我的xhtml页面

<h:form id="form">
    <p:panel header="Prix des matériaux " style="width : 664px; " >  
        <br />
        <p:dataTable id="cars" var="car" value="#{materielbean.listitemsmaterielBean}"
            rowKey="#{car.iditemsmateriel}"  paginator="true" rows="20"  
            selection="#{materielbean.selecteditemforprix}" selectionMode="single" > 
            <p:ajax event="rowSelect"  update=":form:dialog" oncomplete="PF('carDialog').show()"/>  
            <f:facet name="header">  
                Liste de de matériel  
            </f:facet>  
            <p:column headerText="Désignation" filterBy="designation"  >  
                #{car.designation}  
            </p:column>  
            <p:column headerText="Unité">  
                #{car.unite}  
            </p:column>  
            <p:column headerText="Prix en DT" >  
              #{car.prix} 
            </p:column>
        </p:dataTable>  

        <p:dialog id="dialog" header="Changer le prix d'un article" widgetVar="carDialog"
            resizable="true" showEffect="fade" hideEffect="explode">  
            <h:panelGrid columns="3">         
                <h:outputText value=" #{materielbean.selecteditemforprix.designation}" /> 
                <p:inputText value="#{materielbean.selecteditemforprix.prix}"/>
                <p:commandButton value="OK"  action="#{materielbean.modifprixofitem()}"
                    onclick="PF('carDialog').hide()" update=":form:cars"   />
            </h:panelGrid>
        </p:dialog>  
    </p:panel>  
</h:form>

And this is the backing bean to modify the selected object 这是修改所选对象的支持Bean

@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();  
    }

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 当我单击“确定”时,我从输入文本中获取新值,更新数据库中的对象,最后更新数据表,但是当我这样做时,出现错误提示

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

Well the problem is in the last lign selecteditemforprix = new ItemsMateriel(); 好了,问题出在最后一次selecteditemforprix = new ItemsMateriel(); 。itemforprix selecteditemforprix = new ItemsMateriel(); i don't really know what's the problem with that lign but when i deleted it everything works fine, any other clarifications will be appreciated . 我真的不知道该逻辑的问题是什么,但是当我删除它时,一切正常,其他的说明将不胜感激。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 javax.el.E​​LException:java.lang.ClassCastException: - javax.el.ELException: java.lang.ClassCastException: Tomcat 7 javax.el.E​​LException - Tomcat 7 javax.el.ELException javax.el.E​​LException:java.util.AbstractList.add中的java.lang.UnsupportedOperationException - javax.el.ELException: java.lang.UnsupportedOperationException at java.util.AbstractList.add javax.el.E​​LException:java.lang.NoClassDefFoundError:org / hibernate / HibernateException - javax.el.ELException: java.lang.NoClassDefFoundError: org/hibernate/HibernateException javax.el.E​​LException:java.lang.NoClassDefFoundError:jxl / read / biff / BiffException - javax.el.ELException: java.lang.NoClassDefFoundError: jxl/read/biff/BiffException FullAjaxExceptionhandler仅捕获javax.el.E​​LException或java.lang.Throwable - FullAjaxExceptionhandler only catches javax.el.ELException or java.lang.Throwable Tomcat 7找不到我的类抛出javax.el.E​​LException:java.lang.NoClassDefFoundError - Tomcat 7 can't find my class throws javax.el.ELException: java.lang.NoClassDefFoundError Javax.el.E​​LException:无法解析表达式 - Javax.el.ELException: Failed to parse the expression javax.faces.el.EvaluationException: java.lang.NullPointerException - javax.faces.el.EvaluationException: java.lang.NullPointerException javax.el.E​​LException:无法将 [2020-01-28T12:53:00.000+0000] 类型 [class java.lang.String] 转换为 [class java.util.Date] - javax.el.ELException: Cannot convert [2020-01-28T12:53:00.000+0000] of type [class java.lang.String] to [class java.util.Date]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM