Primefaces <p:spinner> with <p:ajax ... =“”listener =“”> </p:ajax> </p:spinner>

时间:2014-05-27 08:52:10

标签: ajax jsf jsf-2 primefaces liferay

我在JSF2中编写了这段代码 - 在Liferay 6.2环境中使用PrimeFaces 5.0。旋转器的听众永远不会被解雇。我也试着写listener="#{managedBean.myListener()}" (see below for other way ),但这没效果。任何人都可以帮助我吗?

view.xhtml

<f:view
xmlns="http://www.w3.org/1999/xhtml"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head />
<h:form id="form">

<p:dataTable id="basicDT" 
             var="item" 
             value="#{managedBean.list}"
             >
    <p:column headerText="..." width="60%">
       ...
    </p:column>
     ...
     <p:column headerText="Column2" width="20%">
        <p:spinner id="mySpinner"                
                   stepFactor="1"                                    
                   min="1"
                   value="#{item.value}" 
                  >
                    <p:ajax 
                            update=":form:spinnerValue" 
                            listener="#{managedBean.myListener}" />
        </p:spinner>
    </p:column>
    </p:dataTable>

     <p:outputPanel id="container">
          <p:outputLabel id="spinnerValue" value="#{managedBean.labelValue}"/>
    </p:outputPanel>
</h:form>

这是支持bean代码:MyManagedBean.java

@ManagedBean(name = "managedBean")
@RequestScoped
public class MyManagedBean extends GenericFacesPortlet {

    private double labelValue;
    private ArrayList<MyObject> list;

    public void myListener(){
        System.out.println("Listener fired!");
        ...
    }

// getters & setter
}

问题是听众永远不会被解雇!

0 个答案:

没有答案