Meu codigo não funciona o new instance
import acao.NovaEmpresaForm;
import acao.RemoveEmpresa;
import jakarta.servlet.RequestDispatcher;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
@WebServlet("/entrada")
public class UnicaEntradaFilter extends HttpFilter implements Filter {
public void doFilter(ServletRequest requestServlet, ServletResponse responseServlet, FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) requestServlet;
HttpServletResponse response = (HttpServletResponse) responseServlet;
String paramAcao = request.getParameter("acao");
String nome;
String nomeDaClasse = "acao." + paramAcao;
try {
Class classe = Class.forName(nomeDaClasse);//carrega a classe com o nome
Acao acao = (Acao) classe.newInstance();
nome = acao.executa(request, response);
} 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]);
}
}
}
O método fica com um risco e na cor cinza e quando eu coloco o servidor para rodar ele da o esse erro