import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/listaEmpresas")
public class ListaEmpresaServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public ListaEmpresaServlet() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
Banco banco = new Banco();
List<Empresa> lista = banco.getEmpresas();
request.setAttribute("empresas", lista);
RequestDispatcher rd = request.getRequestDispatcher("listaEmpresas.jsp");
rd.forward(request, response);
}
}
continuação do codigo onde ta a parte servelet lista empresa