Ao tentar busca ocorre o erro a seguir, mesmo utilizando doPost e setando o method POST no index
insira seu código aqui
package br.com.alura.gerenciador.web;
import java.io.IOException; import java.io.PrintWriter; import java.util.Collection;
import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
import br.com.alura.gerenciador.Empresa; import br.com.alura.gerenciador.dao.EmpresaDAO;
@WebServlet(urlPatterns="/busca") public class BuscaEmpresa extends HttpServlet {
@Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { PrintWriter writer = resp.getWriter(); writer.println("
"); writer.println("Resultado da busca: "); String filtro = req.getParameter("filtro"); Collection empresas = new EmpresaDAO().buscaPorSimilaridade(filtro);writer.println("
- "); for (Empresa empresa : empresas) { writer.println("
- " + empresa.getId() + ": " + empresa.getNome() + "
- "); } writer.println("
writer.println("
");}
} : HTTP Status 405 - HTTP method GET is not supported by this URL type Status report message HTTP method GET is not supported by this URL
description The specified HTTP method is not allowed for the requested resource.
Apache Tomcat/7.0.73