alguém é capaz de detectar algo errado no código abaixo? quando eu executo, apos digitar o usuario e a senha, a pagina fica em branco.
public class Login extends HttpServlet {
static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
static final String DATABASE_URL = "jdbc:mysql://localhost/horalivre";
static final String DB_USER = "root";
static final String DB_PASS = "kmo1982";
public void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String nome = request.getParameter("nome");
String senha = request.getParameter("senha");
Connection connection = null;
Statement statement = null;
try
{
Class.forName( JDBC_DRIVER );
connection = DriverManager.getConnection( DATABASE_URL, DB_USER, DB_PASS );
statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("SELECT id, senha FROM usuario WHERE nome='"+nome+"';" );
String pwd = resultSet.getString("senha");
RequestDispatcher rd;
if (pwd.equals(senha)) {
Cookie c = new Cookie("user",resultSet.getString("id"));
c.setMaxAge(1000000);
response.addCookie(c);
rd = getServletContext().getRequestDispatcher("/menu.jsp");
}
else {
rd = getServletContext().getRequestDispatcher("/erro.jsp");
}
rd.forward(request,response);
}
catch (SQLException sqlException)
{
sqlException.printStackTrace();
}
catch (ClassNotFoundException classNotFound)
{
classNotFound.printStackTrace();
}
finally
{
try
{
statement.close();
connection.close();
}
catch ( Exception exception )
{
exception.printStackTrace();
}
}
}