idea中web.xml报错 Servlet should have a mapping

这次是手工建立的web工程目录,在配置webapp/WEB-INF/web.xml的Spring MVC的DispatcherServlet时,在servlet-name上报错:Servlet should have a mapping

解决:File–>Project Structure–>Modules–>Web–>Deployment Descriptors–>右边加号,新添加一个,像下面这样
在这里插入图片描述