Primefaces selectonemenu zeigt Daten außerhalb der Eingabe an [duplizieren]

Diese Frage hat hier bereits eine Antwort:

Eine oder mehrere Ressourcen haben das Ziel "Kopf", aber in der Ansicht wurde keine "Kopf" -Komponente definiert. 2 Antworten

Ich bin neu in der Webprogrammierung und schaffe es, die richtigen Verbindungen herzustellen, damit das Dropdown-Menü gefüllt wird. Ich verwende Eclipse, das neueste JDK, Wildfly 10 Server, MySQL Server 5.7, Primefaces 5.3, Javax.faces 2.2.

Dies ist die Seite:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"      
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
      >

<head>
	<title>combobox</title>
</head>
<body>


	<h:form id="form1">
		<p:panel header="Ingreso" style="width: 600px;">
			<h:panelGrid columns="2">
				<h:outputText value="Provincia: " />
				<p:selectOneMenu value="#{Usuario.provincia}" id="prov" 
                                 valueChangeListener="#{Usuario.processCant()}" >
					<f:selectItem itemLabel="Seleccione" itemValue="" />
					<f:selectItems value="#{Usuario.provincias}" />	
					<p:ajax update="cant" event="change" />				
				</p:selectOneMenu>
				
				<h:outputText value="Cantón: " />  
                <p:selectOneMenu value="#{Usuario.canton}" id="cant" valueChangeListener="#{Usuario.processParr()}"> 
                        <f:selectItem itemLabel="Seleccione" itemValue="" />
                        <f:selectItems value="#{Usuario.cantones}"/>
                        <p:ajax update="parr" event="change" />	
                </p:selectOneMenu>
                
                <h:outputText value="Parroquia:  " />  
                <p:selectOneMenu value="#{Usuario.parroquia}" id="parr"> 
                        <f:selectItem itemLabel="Seleccione" itemValue="" />
                        <f:selectItems value="#{Usuario.parroquias}"/>
                </p:selectOneMenu>
   ,                 
			</h:panelGrid>
			
		</p:panel>
	</h:form>
</body>
</html>

Und das ist die Java:

@ManagedBean(name="Usuario")
@SessionScoped
public class Usuario implements Serializable {
    private static final long serialVersionUID = 1L;
    private int ID;
    private String nombre;
    private String apellido;

    private String fecha;
    private String lugar;
    private String numero;
    private String Provincia;
    private List<SelectItem> Provincias; 
    private String Canton;
    private List<SelectItem> Cantones;
    private String Parroquia;
    private List<SelectItem> Parroquias;

    public List<SelectItem> getProvincias() {
        List<SelectItem> catProvincias = new ArrayList<SelectItem>();
        try {
            Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/schema", "root", "root");
            Statement st = con.createStatement();
            ResultSet rs = null;
            String myQuery = "SELECT Provincia FROM `schema`.provincia;"; 
            rs = st.executeQuery(myQuery);
            while (rs.next()) {
                catProvincias.add(new SelectItem(rs.getString("Provincia")));
            } 
        } catch (Exception ex) {
            ex.printStackTrace();
        } 
        return catProvincias;
    }
    public List<SelectItem> getCantones() {
        List<SelectItem> catCantones = new ArrayList<SelectItem>();
        try {
            Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/schema", "root", "root");
            Statement st = con.createStatement();
            ResultSet rs = null;
            String myQuery = "SELECT Canton FROM `schema`.Canton WHERE Padre=(select Provincia from `schema`.Provincia where Provincia='"+ Provincia + "')";

            rs = st.executeQuery(myQuery);
            while (rs.next()) {
                catCantones.add(new SelectItem(rs.getString("Canton")));
            } 
        } catch (Exception ex) {
            ex.printStackTrace();
        } 
        return catCantones;
    }
    public List<SelectItem> getParroquias() {
        List<SelectItem> catParroquias = new ArrayList<SelectItem>();
        try {
            Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/schema", "root", "root");
            Statement st = con.createStatement();
            ResultSet rs = null;
            String myQuery = "SELECT Parroquia FROM `schema`.parroquia WHERE Padre=(select Canton from `schema`.Canton where Canton='"+ Canton +"')";
            rs = st.executeQuery(myQuery);
            while (rs.next()) {
                catParroquias.add(new SelectItem(rs.getString("Parroquia")));
            } 
        } catch (Exception ex) {
            ex.printStackTrace();
        } 
        return catParroquias;
    }
    public void processCant() {
        getCantones();
    }
    public void processParr() {
        getParroquias();
    }

...

Und das ist das Ergebnis:

Wie Sie sehen können, werden die Daten außerhalb dupliziert, es wird ein nicht vorhandener Eingabetext angezeigt, und der Stil sieht überhaupt wie Primefaces aus. Ich habe keine Ahnung, was passiert, bitte geben Sie Rat.

Antworten auf die Frage(2)

Ihre Antwort auf die Frage