Fala ae Gustavo,
acho que vc se deu bem com jquery-ui, pois fez com muito mais detalhes do que eu…rs
Bem vamos lá, a sua action esta sendo chamada corretamente?
Se estiver o que pode esta dando problema eu acho que é no momento de escrever no response.
vc faz assim:
success : function(data, textStatus, jqXHR) {
console.log(data);
var items = data;
response(items);
sei que tentou tb com PrintWrite, mas olha como fiz bem simples…
Agora olha como eu fiz, apesar de ser uma implementaçao de Servlet bem simples…
@Override
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
String term = request.getParameter("term");
String[] valueBase = { "actionScript", "appleScript", "asp", "Basic",
"Bol", "C", "C++" }; //Aqui pode ser sua consulta de BD.
List<String> values = new ArrayList<String>();
if (term != null) { // term
for (String value : valueBase) {
if (value.startsWith(term)) {
values.add(value);
}
}
}
[b] Gson gson = new Gson();[/b] // Aqui a biblioteca que uso do json, para passar o array recebido em notação json, ou seja transforma objeto JavaScript em String
String jSon = gson.toJson(values);
response.getWriter().write(jSon); // Aqui escrevo meu json no response. ESSA PARTE VC esta fazendo no javascript tente dessa forma por favor.
response.getWriter().flush();
}
Abs,