Check out example codes for "the type javax.servlet.ServletException cannot be resolved. It is indirectly referenced from required .class files". It will help you in understanding the concepts better.

Code Example 1

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.1.0</version>
    <scope>provided</scope>
</dependency>

Code Example 2

<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-api</artifactId>
    <version>7.0</version>
    <scope>provided</scope>
</dependency>

Learn ReactJs, React Native from akashmittal.com