使用 IntelliJ IDEA 请按照正确的创建项目步骤来创建项目:
1)File -> New Project -> Maven -> Next
2)GroupId: com.公司名.项目名
ArtifactId:项目名 -> Next
3)Project name: 项目名 ->Finish
4)对工程根包,右键-> Add Framework Support... -> 选择Web Application(x.x) -> OK

点开看下路径:
如果java是蓝色的,说明是项目的Root Source
或者使用File -> Project Structure -> Modules

注意:
正确的目录应该是这样:

这个目录有问题:
打开看不到目录:

注意:
web.xml
与 DispatcherServlet的配置文件 DispatcherServlet-servlet.xml
应该都要放在WEB-INF
目录下:

不能放在
resources
.
** 注意: **
如果自定义配置DispatcherServlet-servlt.xml,放置在自定义的目录下,需要init-param,而不是context-param:

注意
如果正确的工程目录:
web这个文件夹会有蓝色的点。
这个是正确的:

这个是错误的:

下面也是错误的:

如果没有就是错误的,要重新设置Web Source Directory:
路径在:Project Structs -> Project Settings -> Facets -> Web -> WebSources Directory. 去设置。
网友评论