1. Error in adding Maven project in idea: Java: package javax Servlet does not exist. As shown in the figure:
2. Solution
1. In file — > Project Structure –> Make changes in modules
2. Select dependencies in modules and click + — > Jars or directories to add
3. Select the local Tomcat installation path, go to the lib folder and select: jsp-api.jar and servlet-ap.jar, then click OK, we can see two more packages, click Apply OK, the following figure.
4. Redeploy the project to run successfully.