Código:
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, ClassNotFoundException { String I,N,D,M; response.setContentType("text/html;charset=UTF-8"); PrintWriter pw=response.getWriter(); String url = "jdbc:mysql://localhost:3306/escuela"; String usuario = "root"; String contraseña = "ravilion1"; Connection con = null; try { pw.println("Hola1"); Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection(url, usuario , contraseña); Statement st = con.createStatement(); pw.println("<table border='1';style='width:75%'>"); java.sql.ResultSet rs; rs=st.executeQuery("Select * from Alumnos"); while( rs.next() ){ pw.println("Hola2"); I=rs.getString("Id_Alumno"); N=rs.getString("Nombre"); D=rs.getString("Domicilio"); M=rs.getString("Id_Materia"); pw.println(" <tr>"); pw.println(" <th>"+I+" </td>"); pw.println(" <th>"+N+"</td>"); pw.println(" <th>"+D+"</td>"); pw.println(" <th>"+M+"</td>"); pw.println(" </tr>"); } pw.println("</table>"); } catch (SQLException ex) { Logger.getLogger(ConsultaAlmuno.class.getName()).log(Level.SEVERE, null, ex); } }