hello all...
I am developing a password verification
servlet. Which takes in emplyee id & pw from users & authenticates them from the DB
but when I take the parameters from a web pae it gives me an error saying 405 resource not allowed
here is the code: this is just a
test servlet I want to mdify it after it has done the authentication....
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
public class PWTest extends HttpServlet
{
String tpw ="";
String temp_id = "";
String query="";
String demp_id="";
String demp_pw="";
Connection con;
Statement st;
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
temp_id = req.getParameter("emp_id");
tpw = req.getParameter("pw");
query = "Select emp_pw from Emp_PW where emp_id = "+temp_id;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("Jdbc:Odbc:scomm");
st = con.createStatement();
ResultSet rs = st.executeQuery(query);
while (rs.next())
{
demp_pw = rs.getString(1);
}
con.close();
}
catch(Exception e)
{
e.printStackTrace();
}
if(demp_pw.equals(tpw))
{
System.out.println("Password Correct");
}
else
System.out.println("Password incorrect");
System.out.println(demp_pw);
}
}