prob.. in login page
hi..all of u....
i have made a login page in html page...in which two text field there..named username and password...
i want to do the stuff that if the user enter correct username and password..then it displays a pop up window mentioning that u have successfully enetered and it then directly went into the mypage.jsp page...(targeted page)
and if users enter wrong entry then it displays error in another page..
plz... do the needful for me....i am not getting any thing....
my code is as follow:
String Username = request.getParameter("msno");
String Password = request.getParameter("pass");
sql = conn.prepareStatement("SELECT * FROM login_mast WHERE name = '" + Username + "' and password='"+Password+"' ");
results = sql.executeQuery();
String Dbname = results.getString("name");
String Dbpassword = results.getString("password");
out.println("<tr><td> <INPUT TYPE='TEXT' size='5' value='" + Dbname + "' readonly </td>");
out.println("<td> <INPUT TYPE='TEXT' size='5' value='" + Dbpassword + "' readonly </td></tr>");
catch (SQLException s)
don't you have to connect to the database before you start executing SQL statments?
The reason you don't see anything on the screen is fairly simple (if I'm correct). You always execute the SQL statement (I'm assuming you have made the database connection in an earlier part of the code not included here). However, you only print the login page when you actually find something in the dabase. Which is not going to happen before the user submits his username / password.
You should put the out.println piece outside the while (rs.next()) loop, this way, this part of the code will always be executed and thus the user will always see the login page.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center