Home > front end >  I ask why I wrote the doPost and doGet method showed "this URL does not support Http method is
I ask why I wrote the doPost and doGet method showed "this URL does not support Http method is

Time:12-19

Package the servlet;

The import Tools. DBUtils;
The import com. Student;

The import javax.mail. Servlet. ServletException;
The import javax.mail. Servlet. HTTP. HttpServlet;
The import javax.mail. Servlet. HTTP. It;
The import javax.mail. Servlet. HTTP. HttpServletResponse;
import java.io.IOException;
Import the Java. SQL. SQLException;
import java.util.List;

Public class XiuGaiServlet extends the HttpServlet {
@ Override
Protected void doPost (it the req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
Student stu=new Student();
Stu. SetMingzi (the req. GetParameter (" mingzi "));
Stu. SetDizhi (the req. GetParameter (" dizhi "));
Stu. SetYuwen (the req. GetParameter (" yuwen "));
Stu. SetShuxue (the req. GetParameter (" shuxue "));
Stu. SetYingyu (the req. GetParameter (" yingyu "));
Try {
Boolean ok=new DBUtils (.) xiugai (stu);
If (ok) {
Resp. SendRedirect (" sousuo ");
}
{} the catch (SQLException throwables)
Throwables. PrintStackTrace ();
}
}

@ Override
Protected void doGet (it the req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
String id=the req. GetParameter (" id ");
Try {
List List=new DBUtils (.) sousuoId (id);
If (a list!=null) {
The req. SetAttribute (" xinxi ", a list);
The req. GetRequestDispatcher (" xiugai. JSP "). The forward (the req, resp);
} else {
The req. SetAttribute (" cuowu, "" no");
resp.setContentType("text/html; charset=utf-8");
The req. GetRequestDispatcher (" sousuo. JSP "). The forward (the req, resp);
}
{} the catch (SQLException throwables)
Throwables. PrintStackTrace ();
}
}
}





//form the following
ID


Name & lt;/td>



Address & lt;/td>



Chinese & lt;/td>



Mathematics & lt;/td>



English & lt;/td>




  • Related