at br.com.alura.gerenciador.servlet.UnicaEntradaServlet.service(UnicaEntradaServlet.java:35)
GRAVE: Servlet.service() for servlet [br.com.alura.gerenciador.servlet.UnicaEntradaServlet] in context with path [/gerenciador] threw exception [java.lang.ClassNotFoundException: br.com.alura.gerenciador.acao.LoginForm] with root cause
java.lang.ClassNotFoundException: br.com.alura.gerenciador.acao.LoginForm
Aqui está a minha classe UnicaEntradaervlet @WebServlet("/entrada") public class UnicaEntradaServlet extends HttpServlet { private static final long serialVersionUID = 1L;
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String paramAcao = request.getParameter("acao");
String nomeDaClasse = "br.com.alura.gerenciador.acao." +
paramAcao;
String nome = null;
try {
Class classe = Class.forName(nomeDaClasse);
Acao acao = (Acao) classe.newInstance();
try {
nome = acao.executa(request,response);
} catch (ServletException | IOException | ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (ClassNotFoundException |
InstantiationException |
IllegalAccessException e) {
throw new ServletException(e);
}
String[] tipoEEndereco = nome.split(":");
if(tipoEEndereco[0].equals("forward")) {
RequestDispatcher rd =
request.getRequestDispatcher("WEB-INF/view/" + tipoEEndereco[1]);
rd.forward(request, response);
} else {
response.sendRedirect(tipoEEndereco[1]);
}
}
}