I was trying to implement a login filter in my web app with jsf 2, following this guide:
https://stackoverflow.com/tags/servlet-filters/info
after I compiled
The answer provided by @Matthias Herlitzius is mostly correct. Just for further clarity.
The servlet-api jar is best left up to the server to manage see here for detail
With that said, the dependency to add may vary according to your server/container. For example in Wildfly the dependency would be
org.jboss.spec.javax.servlet
jboss-servlet-api_3.1_spec
provided
So becareful to check how your container has provided the servlet implementation.