0

I'm developing a simple login/logout application with JSF 2.0, GlassFish 3, Eclipse IDE. For some reason I need to implement a filter.

When I'm trying to import the necessary classes I get the following eclipse error:

The import javax.servlet cannot be resolved

I was under the impression that javax packages are included in JDK.

Note: I created a new project without the JSF settings and the import works just fine.

Ionut
  • 2,788
  • 6
  • 29
  • 46

1 Answers1

1

javax.servlet.* is part of the Java EE SDK. You need to add servlet-api.jar to the build path of your Eclipse project. I would imagine you can find it in one of the Glassfish directories.

Edit: The accepted answer to Tomcat 6 conversion to Glassfish v3: servlet-api, el-api jars contains better advice then I have just given you above!

Community
  • 1
  • 1
Paul Medcraft
  • 1,386
  • 11
  • 23
  • Should I configure some path to the Glassfish directory containing the import or is it OK to just paste the jar in WEB-INF/lib? – Ionut Jan 14 '12 at 21:59
  • 1
    Please see the accepted answer to http://stackoverflow.com/questions/3913444/tomcat-6-conversion-to-glassfish-v3-servlet-api-el-api-jars - definitely don't paste it into WEB-INF/lib. If you do that and deploy it on something other than Glassfish (or possibly on a different version of Glassfish) you may see some conflicts. (Each server will include its own specific implementation of servlet-api.jar) – Paul Medcraft Jan 14 '12 at 22:04