title: Blank Servlet with Stored Procedures
body: <p>i'm pretty new at programming, so its a bit hard for me x.x, but i'm trying to execute a login(JSP) with a stored procedure on java (servlet), sadly the servlet page only gives me a blank page and doesn't redirect me to the home page homeAlumno.jsp(JSP with just a Hello World at the moment), i'm using netbeans IDE 8.2 (with Tomcat Server) and the DB is Oracle 11g Express Edition with a few tables, any help or suggestions will be appreciated.</p>
  
  <p>pd: first post , sorry if i post something wrong :'D</p>
  
  <p>and heere is the code</p>
  
  <p>login.jsp</p>
  
  <pre><code>&lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
          &lt;title&gt;Login CEM&lt;/title&gt;
      &lt;/head&gt;
      &lt;body style="text-align: center"&gt;
          &lt;h1&gt;Menú CEM&lt;/h1&gt;
          &lt;form method="POST" action="serv_login"&gt;
              &lt;input type="text" name="usuario"  placeholder="Nombre"/&gt;
              &lt;input type="password" name="pass"  placeholder="Password" /&gt;
              &lt;input type="submit" value="Login"/&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Class Conexion (Connection)</p>
  
  <pre><code>package modelo;
  import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.SQLException;
  
      public class Conexion {
          private static Connection cnx = null;
         public static Connection obtener() throws SQLException,    ClassNotFoundException {
        if (cnx == null) {
           try {
           Class.forName("oracle.jdbc.OracleDriver");
           cnx =  DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "system", "123");
       } catch (SQLException ex) {
          throw new SQLException(ex);
       } catch (ClassNotFoundException ex) {
          throw new ClassCastException(ex.getMessage());
       }
    }
    return cnx;
   }
      public static void cerrar() throws SQLException {
            if (cnx != null) {
               cnx.close();
       }
     }
  }
  </code></pre>
  
  <p>serv_login.java (servlet)</p>
  
  <pre><code>package controlador;
  
  import java.io.IOException;
  import java.sql.CallableStatement;
  import java.sql.Connection;
  import java.sql.ResultSet;
  import java.sql.SQLException;
  import java.util.logging.Level;
  import java.util.logging.Logger;
  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;
  import modelo.Conexion;
  
  /**
  *
  * @author asd
   */
  @WebServlet(name = "serv_login", urlPatterns = {"/serv_login"})
  public class serv_login extends HttpServlet {
  
  /**
   * Processes requests for both HTTP &lt;code&gt;GET&lt;/code&gt; and &lt;code&gt;POST&lt;/code&gt;
   * methods.
   *
   * @param request servlet request
   * @param response servlet response
   * @throws ServletException if a servlet-specific error occurs
   * @throws IOException if an I/O error occurs
   */
      protected void processRequest(HttpServletRequest request,    HttpServletResponse response)
          throws ServletException, IOException {
      response.setContentType("text/html;charset=UTF-8");
  
      try {
  
          String usuario = request.getParameter("usuario");
          String pass = request.getParameter("pass");
  
  
  
          CallableStatement stmt = Conexion.obtener().prepareCall("{call LoginJava(?,?)}");
  
          stmt.setString(1, usuario);
          stmt.setString(2, pass);
  
  
          ResultSet rs = stmt.executeQuery();
          RequestDispatcher rd;
  
          rd = request.getRequestDispatcher("login.jsp");
  
          while(rs.next()) {
  
              if(rs.getString("NOMBRE_ALUMN").equals(request.getParameter("usuario")) &amp;&amp; rs.getString("PASS_ALUMN").equals(request.getParameter("pass"))){                                            
                      request.getRequestDispatcher("homeAlumno.jsp"); 
                      rd.forward(request, response);  
                  }else{
                      request.getRequestDispatcher("login.jsp");  
                      rd.forward(request, response);
                  } 
  
              }
  
      } catch (SQLException ex) {
              ex.getMessage();
  
      } catch (ClassNotFoundException ex) {
          Logger.getLogger(serv_login.class.getName()).log(Level.SEVERE, null, ex);
          ex.getMessage();
      }
  
  }
  
  // &lt;editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."&gt;
  /**
   * Handles the HTTP &lt;code&gt;GET&lt;/code&gt; method.
   *
   * @param request servlet request
   * @param response servlet response
   * @throws ServletException if a servlet-specific error occurs
   * @throws IOException if an I/O error occurs
   */
  @Override
  protected void doGet(HttpServletRequest request, HttpServletResponse response)
          throws ServletException, IOException {
      processRequest(request, response);
  }
  
  /**
   * Handles the HTTP &lt;code&gt;POST&lt;/code&gt; method.
   *
   * @param request servlet request
   * @param response servlet response
   * @throws ServletException if a servlet-specific error occurs
   * @throws IOException if an I/O error occurs
   */
  @Override
  protected void doPost(HttpServletRequest request, HttpServletResponse response)
          throws ServletException, IOException {
      processRequest(request, response);
  }
  
  /**
   * Returns a short description of the servlet.
   *
   * @return a String containing servlet description
   */
  @Override
  public String getServletInfo() {
      return "Short description";
  }// &lt;/editor-fold&gt;
  
  }
  </code></pre>
  
  <p>Stored Procedure (Oracle DB)</p>
  
  <pre><code>create or replace procedure LoginJava(usuario ALUMNO.USU_ALUMN%type,
  contraseña ALUMNO.PASS_ALUMN%type)                              
  as 
      v_usuario ALUMNO.USU_ALUMN%type;
      v_contraseña ALUMNO.PASS_ALUMN%type;
  begin
      select USU_ALUMN, PASS_ALUMN into v_usuario, v_contraseña from ALUMNO
      where USU_ALUMN = usuario and PASS_ALUMN = contraseña;           
      return;
  end;
  </code></pre>
  
  <p>Thanks !</p>