error: package javax.servlet does not exist

前端 未结 6 609
鱼传尺愫
鱼传尺愫 2020-12-01 01:39

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

6条回答
  •  爱一瞬间的悲伤
    2020-12-01 02:21

    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.

提交回复
热议问题