I am trying to get info from the html form from my servlet.
My problem is I cant get to wanted method by click() method on my servlet.
my servlet is on package login and its name loginServlet.
If you can tell my what wrong with my code :
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
"Transitional//EN\">\n" +
"<HTML>\n" +
"<HEAD><TITLE>login</TITLE></HEAD>\n" +
"<BODY>\n" +
"<FORM ACTION=login/loginServlet METHOD=click>"+
"<table border ='1'>" +
"<tr>" +
"<th colspan='2'>Register Account Information</th>" +
"</tr>" +
"<tr>" +
"<td>Requested Username:</td>" +
"<td><input type='text' name='username' /></td>" +
"</tr>" +
"<tr>" +
"<td>Password:</td>" +
"<td><input type='password' name='password' /></td>" +
"</tr>" +
"<tr>" +
"<th colspan='2'><input type='Submit' value='Submit'>"+
"</tr>" +
"</table>"+
"</FORM></BODY></HTML>");
}
public void click(){
int i=0;
for (i=0;i<1000;i++){
}
thanks a lot!
you are way off…
the attribute METHOD is for a GET (method called is the servlet’s doGet()) or POST request (method called is the servlet’s doPost()), not for any specific servlet’s method.
So, accordingly, write your code in the respective method.