1.问题:创建maven项目时,选择的是创建web-app项目,但是结果配置之后,却没有web.xml文件。
2.解决办法如下三点:
(1)手动创建web.xml在 src/main/webapp 下
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<display-name>SSM-CRUD</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
(2)如果使用的eclipse ,可以右击项目, 选择java EE tools -> Generate Deploy…
(3)右击maven项目,找到ProjectFacets 取消选中 Dynamic Web Module选项,点击应用,再选中Dyanmic Web Module会出现一个选项卡,点击弹出的选项卡后,输入src/main/webapp点击OK,最后点击Apply and Close即可,至此错误彻底解决!