ActionListener方法未被调用

时间:2015-07-27 11:52:01

标签: jsf primefaces

在我的应用程序中,我正在使用actionListener="#{jobsController.addSequence}"方法调用方法,但由于某种原因它无法正常工作。我无法看到我的代码或EL有任何问题,因为它可以在我使用过的其他地方使用。

这是无效的代码。

<p:dialog header="Remove Job" modal="true" widgetVar="remJob" minHeight="40" width="45%">
    <h:panelGroup styleClass="ContainerIndent" layout="block">

        <h:form id="removeJobForm">

            <h:panelGroup layout="block">
                <p:pickList id="jobPickList" value="#{jobsController.removeJobs}" var="jobs" itemLabel="#{jobs}" itemValue="#{jobs}"/>
            </h:panelGroup>

            <h:panelGroup styleClass="Seperator" layout="block"/>

            <h:panelGroup styleClass="Fright">
                <table border="0">
                    <tr>
                        <td width="110px" align="right">
                            <p:commandButton value="Reset" update="removeJobForm" process="@this" style="width:100px">
                                <p:resetInput target="removeJobForm" />
                            </p:commandButton>
                        </td>
                        <td width="110px" align="right">
                            <p:commandButton value="Submit" style="width:100px" onclick="PF('remJob').hide()" actionListener="#{jobsController.removeJobs}"/>
                        </td>
                    </tr>
                </table>

            </h:panelGroup>

        </h:form>
    </h:panelGroup>
</p:dialog>

这是我使用上述方法的工作代码 在这里我使用了这个actionListener="#{jobsController.addSequence},因为我在上面的代码中使用过它。这没有问题。

<p:dialog header="Create Sequence" modal="true" widgetVar="addSeq" minHeight="40" width="50%">
    <h:panelGroup styleClass="ContainerIndent" layout="block">

        <h:form id="createSeqForm">
            <table border="0" width="100%">                                     
                <tr height="40px">      
                    <td>
                        <h:panelGroup layout="block" styleClass="Fleft">
                            <h:outputText value="Source Rollback After"/>
                        </h:panelGroup>
                        <h:panelGroup layout="block" styleClass="Fright">
                            <h:outputText value=":"/>
                        </h:panelGroup>
                    </td>

                    <td>
                        <h:panelGroup layout="block" styleClass="Fright">
                            <p:inputText style="width:197px" value="#{jobsController.jobBean.seqBean.src_rollback_after}" onkeypress="return isNumberKey(event)"/>
                         </h:panelGroup>
                    </td>
                </tr>

            </table>

            <h:panelGroup styleClass="Seperator" layout="block"/>

            <h:panelGroup styleClass="Fright">
                <table border="0">
                    <tr>
                        <td width="110px" align="right">
                            <!-- <p:growl id="growl" showDetail="true" sticky="true" autoUpdate="true" /> -->
                            <p:commandButton value="Reset" update="createSeqForm" process="@this" style="width:100px">
                        <p:resetInput target="createSeqForm" />
                            </p:commandButton>
                        </td>
                        <td width="110px" align="right">
                            <p:commandButton value="Submit" style="width:100px" update=":createJobForm:sequenceTable" onclick="PF('addSeq').hide()" actionListener="#{jobsController.addSequence}">
                                <p:resetInput target="createSeqForm" />
                                <!-- <p:ajax update=":createJobForm:sequenceTable" resetValues="true" /> -->
                                <!-- <p:poll id="poll" interval="5" update="growl" /> -->
                            </p:commandButton>
                        </td>
                    </tr>
                </table>
            </h:panelGroup>
        </h:form>
    </h:panelGroup>
</p:dialog>

Java方法我试图调用

public DualListModel<String> getRemoveJobs(){
    List<String> source = new ArrayList<String>();
    List<String> target = new ArrayList<String>();

    try {           
        rs = db.select("SELECT JOB_ID FROM IM_JOBS");

        int count=0;

        while (rs.next()) {
            source.add(rs.getString("JOB_ID"));
            System.out.println(count);
            count++;
        }
        System.out.println("Removable Jobs Retrieved and added to the Source");

        jobs = new DualListModel<String>(source, target);
    } catch (SQLException e) {
        e.printStackTrace();
    }

    return jobs;
}

PS:我找不到任何错误。没有例外,没有验证错误或任何不寻常的事情。

0 个答案:

没有答案
相关问题