Hi, Welcome to the Practice House. In this post, I am going to share with you about an error in eclipse.
If you are facing an issue that’s called WebServlet cannot be resolved to a type.
First of all this error occurs when we create a project that’s related to WebServlet in java.
For my case, it has happened when I create a dynamic web project in java. I created this project using eclipse.
Then I solved in this way you have to go to your project properties and target runtimes and check apache tomcat.
Instruction is down below in a screenshot from my eclipse.
Simply check the Apache Tomcat v9.0 ( the version is based on your installation ). I hope this helps. if this does not help you please check through some StackOverflow post and I am sure it will help you to understand why it has happened and how to solve.
Thanks for reading this post. If any query please comments below I will be very much happy to solve your problem.