Professional Documents
Culture Documents
*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
@WebServlet("/Police")
public class Police extends HttpServlet {
public Police() {
super();
}
case 2:
sql="select area,phone from police
where phone="+val;
break;
default:
flag=false;
out.println("Information does not
exist");
}
if(flag) {
ResultSet rs = st.executeQuery(sql);
while (rs.next()) {
out.println("Area: "+rs.getString("area"));
out.println("Area:
"+rs.getString("phone"));
}
}
}
catch(Exception e) {
e.printStackTrace();
}
}
html.
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Police Station </title>
</head>
<body>
<form action = "Police" method = "post" >
<input type = "radio" name = "n" value = 1 checked > Area <br>
<input type = "radio" name = "n" value = 2 > Phone Number <br>
Enter area/phone number : <input type = "text" name = "ap" > <br>
<button type = "Submit" > Submit </button>
<button type = "Reset"> Cancel </button>
</form>
</body>
</html>