IntelliJ IDEA cannot resolve import javax.servlet.*;
As somebody mentioned it above - these libraries are part of an application server so they should not be deployed to the server as other libraries like Spring and so on. You need reference them as a provided resource.
If you are not using Maven for your project (i.e. tutorials etc.) you can go to your Project Structure settings / Modules / your module / Dependencies .. and down under the list of dependendcies is a small plus symbol (+) where you can select "Library" and after that the popup with Application Server Libraries will show. It should be selected as provided afterwards.
The servlet-api.jar is part of your server (Tomcat in this case). You need to either state a reference to that jar in your POM and mark it in 'provided' scope or (if you are not using maven for some reason) you need to add it to your classpath (the libraries of your web module in your project).
The chances are perhaps that your Tomcat installation forder or maven repo is different after your HD reinstall. It seems to be like an environmental issue.