p:命令列表中的commandButton不起作用 [英] p:commandButton inside Orderlist not working

查看:54
本文介绍了p:命令列表中的commandButton不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Primefaces orderList有疑问.

I've got a question regarding Primefaces orderList.

我有一个看起来像这样的orderList:

I have an orderList which looks like this:

<p:orderList id="technikersTable"
                        value="#{systemlandschaftRessourceHandler.entity.technikers}" 
                        var="_techniker"  
                        itemValue="#{_techniker}" 
                        converter="#{entityConverter}"
                        controlsLocation="none">  

                <f:facet name="caption">Techniker</f:facet>  

                <p:column>
                    <p:commandButton styleClass="colButton" 
                                    icon="ui-icon-trash" 
                                    action="#{systemlandschaftRessourceHandler.removeTechniker(_techniker)}" 
                                    update=":systemLandschaftTabView:sysObjektDetailPanelForm:technikersTable"/>
                </p:column>
                <p:column style="width:75%;">  
                   <p:outputLabel value="#{_techniker.verantwortlich.displayName}" />
                </p:column>

            </p:orderList>

我的问题是,第一列中的commandButton引发了空指针异常. 该请求永远不会到达我的bean.

My problem is, that the commandButton in the first column throws a null pointer exception. The request never reaches my bean.

命令按钮是否可能在orderList内不起作用? 我已经成功地使用dataTables做了同样的事情.

Is it possible that the commandButton is not working inside the orderList? I have done the same thing with dataTables a lot of time successfully.

StackTrace:

StackTrace:

    ERROR 2013-10-15 14:37:55,009 [MmnetExceptionHandler] Fehler auf der Seite: /views/protected/systemlandschaft/systemlandschaftHome.xhtml, isAjaxRequest=true
ERROR 2013-10-15 14:37:55,010 [MmnetExceptionHandler] [SCUE070] Allgemeiner Anwendungsfehler! : java.lang.NullPointerException
    at java.lang.Class.isAssignableFrom(Native Method)
    at org.apache.el.util.ReflectionUtil.isAssignableFrom(ReflectionUtil.java:319)
    at org.apache.el.util.ReflectionUtil.getMethod(ReflectionUtil.java:185)
    at org.apache.el.parser.AstValue.invoke(AstValue.java:257)
    at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
    at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:39)
    at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
    at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    at org.apache.myfaces.extensions.cdi.jsf.impl.security.SecurityViolationAwareActionListener.processAction(SecurityViolationAwareActionListener.java:56)
    at org.apache.myfaces.extensions.cdi.jsf.impl.config.view.ViewControllerActionListener.processAction(ViewControllerActionListener.java:68)
    at org.apache.myfaces.extensions.cdi.jsf.impl.listener.action.CodiActionListener.processAction(CodiActionListener.java:58)
    at javax.faces.component.UICommand.broadcast(UICommand.java:315)
    at javax.faces.component.UIData.broadcast(UIData.java:1093)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at org.apache.myfaces.extensions.cdi.jsf2.impl.listener.phase.CodiLifecycleWrapper.execute(CodiLifecycleWrapper.java:95)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:118)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    at de.company.mmnet.sessioninfo.HttpSessionUserFilter.doFilter(HttpSessionUserFilter.java:42)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:101)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
    at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:165)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:679)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931)
    at java.lang.Thread.run(Thread.java:722)

DEBUG 2013-10-15 14:37:55,094 [EntityManagerProducer] EntityManager geschlossen.

推荐答案

您可以在orderList中使用命令按钮.您的问题是您使用#{_ techniker} var作为参数.当您单击按钮时,action属性将在服务器端评估EL表达式,这将导致空指针.

You can use a commandbutton inside an orderList. Your problem is that you are using the #{_techniker} var as a parameter. The action property is evaluating the EL expression on serverside when you click the button, and this is causing the nullpointer.

它确实可以在dataTable中工作,但是datatable组件的设计有所不同.

It does indeed work in a dataTable, but the datatable component is designed differently.

我会考虑使用其他组件,但是如果您确实需要使用订单清单,则可以使用p:remoteCommand将techniker的ID发送到备用Bean.

I would consider using a different component, but if you really need to use the orderlist, you could use the p:remoteCommand for sending the id of the techniker to the backing bean.

Primefaces RemoteCommand

这篇关于p:命令列表中的commandButton不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆