Take the 2-minute tour ×

I have a login form using a jsp to check a username and password against a Mysql database. when I try to make it login it is meant to forward me to a main menu page. However, all that havens is the page goes blank and the jsp file-name is added to the end of the url. the jsp is shown below. what am I doing wrong?


String user=request.getParameter("name");
String passwrd=request.getParameter("pass");


    java.sql.Connection con = DriverManager.getConnection("jdbc:mysql://localhost:8080/languagetest", "root", "password");
     Statement st=con.createStatement();
     ResultSet rs=st.executeQuery("select userid,password from Users");
         String userid=rs.getString(1);
         String password=rs.getString(2);
         if(user.equals(userid) && passwrd.equals(password))

             <jsp:forward page="Mainmenu.html"/>
}catch(Exception e1)

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

you are caught by an exception Never eat an Exception:

catch(Exception e1)

catch(Exception e1)
    {e1.printStackTrace(); // also print some meaning full text for Front-End user}

Print stackTrace, log the trace show meaning full text on the JSP front page on exceptions Most probably you are failing with the DB Connections/drivers not found

share|improve this answer
SEVERE: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure –  user1305085 Mar 27 '13 at 12:09
this link will help you alot. –  usman Mar 27 '13 at 13:53
add comment

Your Answer


