首页 > 解决方案 > 传递给函数问题的 JSF 值

问题描述

出于某种原因,我的函数在提交时没有被调用。有人可以指出我正确的方向吗?我有吸气剂和二传手。我尝试了多种方法但仍然没有成功

所以在后端,我有。公共 int prdcTypeSelection = 00;

    public int getPrdcTypeSelection() {
        return prdcTypeSelection;
    }
    public void setPrdcTypeSelection(int prdcTypeSelection) {
        this.prdcTypeSelection = prdcTypeSelection;
    }

    public void effDateValueChange() {
                LOGGER.info("calling effDtChangeListenerMass");
                System.out.println("PrdTypeSelection"+getPrdcTypeSelection());

            }     

Front end

<ace:dialog widgetVar="effectDatePopup"
                width="455" height="180"
                header="Effective Date Popup"
                draggable="false"
                modal="true"
                closable="true"> 

                  <h:form id="efForm">
                        <h:outputText value="Effective Date Popup TEXT "
                              styleClass="blBlkText" />

                            <h:outputText value="#{paDefAdministrativeDataTableViewBean.paDefAdministrative.defaultEffDate}" style="width:55px;display:block;">
                            <f:convertDateTime pattern="MM/dd/yyyy"/>
                            </h:outputText>







                                            <h:outputText value="Product Type "/>
                                            <h:selectOneMenu value="#{paDefAdministrativeDataTableViewBean.prdcTypeSelection}">
                                            <f:selectItem itemValue="00" itemLabel="All" />
                                            <f:selectItem itemValue="03" itemLabel="03" />
                                            <f:selectItem itemValue="04" itemLabel="04" />
                                            <f:selectItem itemValue="07" itemLabel="07" />
                                            </h:selectOneMenu>




                                         <h:panelGrid style="margin-left: auto; margin-right: auto; text-align: left;" width="100">
                                         <h:commandButton id="submit" action="#{paDefAdministrativeDataTableViewBean.effDateValueChange}" value="Submit"/>
                                         </h:panelGrid>





                                       <h:panelGrid width="100%" style="text-align: right; top:20px;"> <h:commandButton value="Cancel" onclick="effectDatePopup.hide();"/>      </h:panelGrid>

                            </h:form>
        </ace:dialog>   

标签: jsf

解决方案


您的 itemValue 字段 00、03、05 等是字符串,将 prdcTypeSelection 变量更改为字符串或从 itemValue 字段中删除第一个零。如果问题仍然存在,请添加<f:ajax />到 selectOneMenu 组件。


推荐阅读