The session. The setAttribute (" cust_id ", cust_id);
String cust_code=request. The getParameter (" cust_code ");
String drivername="com. Microsoft. Essentially. JDBC. SQLServerDriver";
The String url="JDBC: essentially://127.0.0.1:1433; Databasename=Information System Design ";
String user="sa";
String PWD="7628475";
Class.forname (drivername);
The Connection conn=DriverManager. GetConnection (url, the user, the PWD);
The Statement STMT=conn. CreateStatement ();//from the database inside things compared to
String SQL="select * from the customer where cust_id='" + +" cust_id "and cust_code='" + cust_code + "'";
The ResultSet I=STMT. ExecuteQuery (SQL);
If (i.n ext ())
{
The response. SetHeader (" refresh ", "1; Url=login, JSP ");//jump to success page
}
The else
{
Out.println (i.n ext () + "ff");
Out.println (" & lt; Script language='javaScript' & gt; Alert (' wrong password, please enter the username again. '); </script>" );
The response. SetHeader (" refresh ", "1; Url=sgin_re. HTML ");//return to the login page
}
STMT. Close ();
conn.close();
% & gt;
CodePudding user response:
Print the SQL to perform the following, I knew account password is correct