这个错误如何解决啊?

来源:2-3 页面跳转

玲玲乱乱小年华

2018-06-24 19:56

https://img4.mukewang.com/5b2f86ca00012bb303620508.jpg


package com.weixin.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 列表页面初始化控制
 *
 */
@SuppressWarnings("serial")
public class ListServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {
    // TODO Auto-generated method stub
    req.getRequestDispatcher("/WEB-INF/jsp/back/list.jsp").forward(req, resp);
}
@Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        // TODO Auto-generated method stub
        this.doPost(req, resp);
    }
}


<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
  <display-name>MicroMessage</display-name>

  <servlet>
      <servlet-name>ListServlet</servlet-name>
      <servlet-class>com.weixin.servlet.ListServlet</servlet-class>
  </servlet>
  <servlet-mapping>
     <servlet-name>ListServlet</servlet-name>
     <url-pattern>/list</url-pattern>
  </servlet-mapping>
</web-app>

HTTP Status 405 – Method Not Allowed


Type Status Report

Message HTTP method GET is not supported by this URL

Description The method received in the request-line is known by the origin server but not supported by the target resource.


Apache Tomcat/8.5.16


写回答 关注

2回答

  • 落叶萧萧online
    2018-11-08 19:41:36

    直接把web.xml的配置文件取消了,用@WebServlet("")注解不就可以了

  • 慕粉3993414
    2018-06-25 11:24:27

    你的访问路径应该是:localhost:8080/MicroMessage/list


通过自动回复机器人学Mybatis---基础版

微信公众号自动回复功能学习Mybatis,基础教程加案例实战方式学习

107410 学习 · 786 问题

查看课程

相似问题