Multiple events in the same p:ajax in PrimeFaces

前端 未结 2 1567
-上瘾入骨i
-上瘾入骨i 2021-01-17 16:31

Is it possible to have multiple events in the same p:ajax?

Something like this:



        
2条回答
  •  Happy的楠姐
    2021-01-17 17:02

    Faced with the same problem and came across this post. After trivial investigation, the "multiple events in the same p:ajax"-approach will not work. It is not supported at least for the tested Primefaces 5.3 version. An Exception like this will arise:

    javax.faces.view.facelets.TagException:  Event:firstEvent,secondEvent is not supported.
    

    Some source code from the AbstractBehaviorHandler class:

     ClientBehaviorHolder holder = (ClientBehaviorHolder) parent;
    
        String eventName = getEventName();
    
        if (null == eventName) {
            eventName = holder.getDefaultEventName();
            if (null == eventName) {
                throw new TagException(this.tag, "Event attribute could not be determined: "  + eventName);
            }
        } else {
            Collection eventNames = holder.getEventNames();
            if (!eventNames.contains(eventName)) {
                throw new TagException(this.tag,  "Event:" + eventName + " is not supported.");
            }
        }
    

提交回复
热议问题