-3

I have just installed the new netbeans. I have imported my project from school off of github. I had this project working with no issues like this. Now when i run the program i get an error that one of the imports

 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse; 

I do not remember the java part of the import having an X on the end. Not sure what i should do.

R.McGuire
  • 3
  • 1

1 Answers1

0

Welcome in Stackoverflow:-

Please find your problem solution:

You need to add the Servlet API to your classpath. In Tomcat 6.0, this is in a JAR called servlet-api.jar in Tomcat's lib folder. You can either add a reference to that JAR to the project's classpath, or put a copy of the JAR in your Eclipse project and add it to the classpath from there.

If you want to leave the JAR in Tomcat's lib folder:

  • Right-click the project,

  • click Properties.

  • Choose Java Build Path.

  • Click the Libraries tab Click Add External JARs.

  • Browse to find servlet-api.jar and

  • select it.

Click OK to update the build path.

Or, if you copy the JAR into your project:

  • Right-click the project,
  • click Properties.
  • Choose Java Build Path.
  • Click Add JARs...
  • Find servlet-api.jar in your project and select it.

    Click OK to update the build path.

solution

If you using glassfish server then add below jar in your project via same way.

javax.servlet for glassfish server

Bipil Raut
  • 244
  • 1
  • 10