当前位置: 代码迷 >> 综合 >> HttpServlet:此URL不支持HTTP方法POST ——问题解决
  详细解决方案

HttpServlet:此URL不支持HTTP方法POST ——问题解决

热度:68   发布时间:2023-12-15 15:45:15.0

让servlet中的doGet执行doPost方法,会报错,

去掉super就可以了。

具体原因:点我查看具体原因

	@Overrideprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    super.doPost(req,resp);加上super就会报错,doPost(req, resp);		  去掉super就可以了;}@Overrideprotected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    //???????????req.setCharacterEncoding("utf-8");resp.setContentType("text/html;charset=utf-8");....................................
  相关解决方案