jsf 2 - <p:autoComplete> Uncaught TypeError: Cannot read property 'keyCode' of undefined -
this question has answer here:
i'm trying use <p:autocomplete />
of primefaces 5.1, reason when load page receive folowing message on browsers console:
uncaught typeerror: cannot read property 'keycode' of undefined
my view this:
<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:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui"> <h:outputscript library="primefaces" name="jquery/jquery.js"/> <h:outputscript library="primefaces" name="jquery/jquery-plugins.js"/> <ui:composition> <div class="navbar navbar-inverse navbar-fixed-top" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <p:link outcome="index" value="chamada parlamentar" styleclass="navbar-brand header-link" /> </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav navbar-right"> <li> <p:link href="https://github.com/thiagokairala/reconstru-ochamadaparlametnar"> <h:outputtext value="código fonte:" /> <p:graphicimage url="/images/github.png" /> </p:link> </li> <li> <p:link href="http://dados.gov.br/dados-abertos/"> <h:outputtext value="lei dos dados abertos" /> </p:link> </li> <li> <p:link outcome="about" value="nós" /> </li> <li> <p:link outcome="help" value="ajuda" /> </li> </ul> <h:form class="navbar-form navbar-right" onsubmit="#{deputymb.statistics}"> <p:autocomplete value="#{deputymb.deputyname}" completemethod="#{autocomplete.completedeputies}" /> </h:form> </div> </div> </div> </ui:composition>
my auto complete method this:
package jsfconnection; import java.util.arraylist; import java.util.list; import javax.faces.bean.managedbean; @managedbean public class autocomplete { public list<string> completedeputies(string prefix) { list<string> deputies = new arraylist<string>(); (int = 0; < 10; i++) { deputies.add(integer.tostring(i)); } return deputies; } }
how caused , how can solve it?
i fixed, simple jquery conflit.