0

私は PrimeFaces 4.0 で JSF-2.1 を使用しており、選択した値に基づいて別のドロップダウンを設定するドロップダウンに部分送信を実装しようとしています。ajax変更イベントは、IPを「選択」から最初のIPに変更すると発生し、dstnドロップダウンに入力されますが、2回目にIPを変更するとイベントは発生しません。

<html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:p="http://primefaces.org/ui">
    <f:view contentType="text/html">
        <h:head>
        </h:head>
    <h:body>
    <h:form>
                        <p:messages id="validations" />
    <h:outputLabel for="ip" value="Source:"></h:outputLabel>
                            <p:selectManyMenu id="ip" value="#{inputBean.ip}"
                                required="true" requiredMessage="Enter Source">
                                <f:selectItems value="#{inputBean.ipMenu}" />
                                <p:ajax listener="#{inputBean.populateDstn}" event="change" 
                                    update="dstn" process="@this" partialSubmit="true"/>
                            </p:selectManyMenu>
                            <h:outputLabel for="dstn" value="Destination:"></h:outputLabel>
                            <p:selectManyMenu id="dstn" value="#{inputBean.dstn}"
                                required="true" requiredMessage="Enter Destination">
                                <f:selectItems value="#{inputBean.dstnMenu}" />
                            </p:selectManyMenu>
    </h:form>
    </h:body>
    </f:view>
    </html>

バッキングビーン

 @ManagedBean
    @ViewScoped

    public class InputBean implements Serializable
    {
    private static final long serialVersionUID = 1L;
        private List<Long> ip;
        private Map<String, Long> ipMenu;
        private List<Long> dstn;
        private Map<String, Long> dstnMenu;
        @ManagedProperty("#{dataBase}")
    private transient DataBase db;

        private StringBuilder query;


    @PostConstruct
        public void init()
        {
    ipMenu.put("Select", null);
            dstnMenu.put("Select", null);
    try
            {
Connection connection = null;
            ResultSet rs = null;
            PreparedStatement pst_query = null;
                        query.setLength(0);
                connection = db.getConnection();
                query.append("SELECT DISTINCT IPADDRESS FROM ADDR ORDER BY IPADDRESS ");
                pst_query = connection.prepareStatement(query.toString());
                rs = pst_query.executeQuery();
                while (rs.next())
                {
                    ipMenu.put(rs.getLong("IPADDRESS")), rs.getLong("IPADDRESS"));

                }
                rs.close();
                query.setLength(0);
                pst_query.close();
                connection.close();
            }
            catch (SQLException e)
            {
                e.printStackTrace();
            }
    }
    //getters and setters

    public void populateDstn()
        {
            System.out.println("ipaddr : " + this.ip);
            try
            {
                dstnMenu.clear();
Connection connection = null;
        ResultSet rs = null;
        PreparedStatement pst_query = null;
                connection = db.getConnection();
                for (int i = 0; i < ip.size(); i++)
                {
                query.append("SELECT DISTINCT DSTN FROM ADDR " + "WHERE IPADDRESS= '" + this.ip.get(i) + "'  ORDER BY DSTN ");
                pst_query = connection.prepareStatement(query.toString());
                rs = pst_query.executeQuery();
                while (rs.next())
                {
                    dstnMenu.put(rs.getLong("DSTN"), rs.getLong("DSTN"));
                }
                rs.close();
                query.setLength(0);
                pst_query.close();
                connection.close();
                }
            }
            catch (SQLException e)
            {
                FacesContext.getCurrentInstance().addMessage("tableplot:validations", new FacesMessage("Problem fetching Destinations"));
                e.printStackTrace();
            }

        }
    }

エラー

Uncaught ReferenceError: cfgx is not defined primefaces.js.xhtml?ln=primefaces:1
    PrimeFaces.createWidget primefaces.js.xhtml?ln=primefaces:1
    PrimeFaces.cw primefaces.js.xhtml?ln=primefaces:1
    (anonymous function)
    (anonymous function) jquery.js.xhtml?ln=primefaces:14
    bG.extend.globalEval jquery.js.xhtml?ln=primefaces:14
    (anonymous function) jquery.js.xhtml?ln=primefaces:21
    bG.extend.each jquery.js.xhtml?ln=primefaces:14
    bG.fn.extend.domManip jquery.js.xhtml?ln=primefaces:21
    bG.fn.extend.append jquery.js.xhtml?ln=primefaces:21
    (anonymous function) jquery.js.xhtml?ln=primefaces:21
    bG.extend.each jquery.js.xhtml?ln=primefaces:14
    bG.fn.bG.each jquery.js.xhtml?ln=primefaces:14
    bG.fn.extend.replaceWith jquery.js.xhtml?ln=primefaces:21
    PrimeFaces.ajax.AjaxUtils.updateElement primefaces.js.xhtml?ln=primefaces:1
    PrimeFaces.ajax.AjaxResponse primefaces.js.xhtml?ln=primefaces:1
    (anonymous function) primefaces.js.xhtml?ln=primefaces:1
    bZ jquery.js.xhtml?ln=primefaces:14
    b7.fireWith jquery.js.xhtml?ln=primefaces:14
    ca jquery.js.xhtml?ln=primefaces:21
    bZ jquery.js.xhtml?ln=primefaces:21
4

0 に答える 0