[Solved] SpringMVC Error: element web-app must be declared

Problem background

Today, when learning spring MVC, you need to configure the web.xml file, and an error message element web app must be declared appears.

 

Solution:

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                      http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
         version="4.0"
         metadata-complete="true">
</web-app>

Read More: