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?
<%@ page language ="java" import="java.sql.*" %>
<%@ page import ="javax.sql.*" %>
<%
String user=request.getParameter("name");
String passwrd=request.getParameter("pass");
try{
Class.forName("com.mysql.jdbc.Driver");
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");
while(rs.next())
{
String userid=rs.getString(1);
String password=rs.getString(2);
if(user.equals(userid) && passwrd.equals(password))
{
out.println("welcome");
%>
<jsp:forward page="Mainmenu.html"/>
<%}
}
}catch(Exception e1)
{}
%>