9

我想使用部分处理,但它在我的代码中不起作用。有人知道为什么吗?

<h:form id="frmVehicle" prependId="false">
   <p:toolbar styleClass="form_toolbar">   
      <p:toolbarGroup>
        <p:commandButton id="save" process="@(form :not(.noprocess))" ajax="false" value="#{uimsgs.save}" action="#{vmsVehicleActionBean.save()}"
      </p:toolbarGroup>
    </p:toolbar>
    <p:messages id="vmsgs" severity="error,warn" autoUpdate="true" />
    <p:tabView id="tabViewSections" orientation="left" styleClass="ses-ui-tabs-left">
      <p:tab title="#{vms_uimsgs['vehicle.tab.data']}">
        <p:panelGrid id="gridHeader" columns="4" columnClasses="form-label,form-input,form-label,form-input" styleClass="form-grid" >
           <p:outputLabel for="kmStatus" value="#{vms_uimsgs['vehicle.kmStatus']}" />
           <p:inputText id="kmStatus" value="#{vmsVehicleActionBean.vehicle.kmStatus}"/>
           <p:outputLabel for="powerKw" value="#{vms_uimsgs['vehicle.power']}" />
           <p:inputText id="powerKw" styleclass="noprocess" value="#{vmsVehicleActionBean.powerKw}">
              <p:ajax event="keyup" update="powerPs" />
           </p:inputText>
           <p:outputLabel value="kw" />
           <p:inputText id="powerPs" styleclass="noprocess" value="#{vmsVehicleActionBean.powerPs}"> 
             <p:ajax event="keyup" update="powerKw" />
           </p:inputText>
           <p:outputLabel value="ps" />
         </p:panelGrid>
       </p:tab>
     </p:tabView>
 </h:form>

两个 setter (kw & ps) 仍在处理中。任何想法?

4

1 回答 1

1

好吧,我创建了一个适用于标准 Primefaces 展示的示例。在您的页面中,我看到了一些奇怪的东西。styleclass="noprocess" 你确定你用这个吗?API 用大写 C 表示 styleClass。

这是一个可以正常工作的示例:

<h:form id="form">
    <p:toolbar id="tool">
        <p:toolbarGroup id="group">
            <p:commandButton value="All" ajax="true" id="btnAll" process="@(input:not(.noprocess))" actionListener="#{personBean.savePerson}" />
        </p:toolbarGroup>
    </p:toolbar>
    <p:messages id="vmsgs" severity="error,warn" autoUpdate="true" />
    <p:tabView id="tabViewSections">
        <p:tab title="test" id="tab">
            <p:panel header="Partial Process">
                <p:panelGrid id="grid" columns="2">
                    <f:facet name="header">
                        <p:messages />
                    </f:facet>
                    <h:outputLabel for="firstname" value="Firstname:" />
                    <p:inputText id="firstname" value="#{personBean.firstname}" />
                    <h:outputLabel for="surname" value="Surname: *" />
                    <p:inputText id="surname" value="#{personBean.surname}" styleClass="noprocess">                         
                    </p:inputText>
                </p:panelGrid>
            </p:panel>
        </p:tab>
    </p:tabView>
</h:form>

然后豆:

public class PersonBean {  

    private String firstname;  

    private String surname;  

    public String getFirstname() {  
        return firstname;  
    }  
    public void setFirstname(String firstname) {  
        this.firstname = firstname;
        System.out.println("Setted firstname: " +firstname);
    }  

    public String getSurname() {  
        return surname;  
    }  
    public void setSurname(String surname) {  
        this.surname = surname;  
        System.out.println("Setted surname: " +surname);
    }  

    public void savePerson(ActionEvent actionEvent) {  
         System.out.println("Fire action event");

    }  
}
于 2013-05-21T14:16:23.280 回答