参考官方文档:https://www.jetbrains.com/help/idea/enabling-web-application-support.html#76efd,亲测有效
When creating a project or module (File | New | Project or File | New | Module). On the first page of the New Project or the New Module wizard, select Java Enterprise, and then select the Web Application checkbox under Additional Libraries and Frameworks.