As an aside, one thing worth noting is that you must have to avoid Java code in JSP-Files. Your Java code must be placed into Servlet and other model classes to handle and process the request. In JSP files, you may use EL (Expression Language) and JSTL . The standard tag library JSTL can do most of the common things that you need scriplets for.
Have a look at good post - How to avoid Java Code in JSP-Files?
In code-snippet, you may add WHERE clause to the SELECT statement :
String username=request.getParameter("txtUsername");
String password=request.getParameter("txtPassword");
Connection cn = DriverManager.getConnection("jdbc:odbc:RentalDB", "", "");
String sql="SELECT * from Member where Email=? and Password=?";
PreparedStatement st = cn.prepareStatement(sql);
st.setString(1,username);
st.setString(2,password);
ResultSet r = st.executeQuery();
if(r.next())
{
//
} __avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241