• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error to import javax.servlet.*

 
paulo cs
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my source code:

This error appear in the lines:
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

How can I do to use servlet into my Galileo? I use Eclipse Galileo.

 
shivendra tripathi
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add servlet jar in your eclipse project class path.
 
paulo cs
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bingo!! That's right.
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If yous et the "targeted runtime" to an application server (like JBoss for example), then Eclipse should pick up the vendor-provided Jar files automatically. Did you set a targeted runtime for your project?
 
Meenu Dharma
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Me too get the same error.

error at:

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


How to Add servlet jar in your eclipse project class path.?

Please help me out.
I'm a beginner.
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Meenu Dharma wrote:Me too get the same error.

error at:

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


How to Add servlet jar in your eclipse project class path.?

Please help me out.
I'm a beginner.


You need to let Eclipse know that your application is going to run on your particular application server. For example, if you plan to deploy your application to JBoss Application Server, you tell Eclipse this, and Eclipse will include the proper JBoss jar files on the build path.

You do this by setting a Targeted Runtime. This is set in the Project properties. In Eclipse, go to Project -> Properties, then click on the Targeted Runtimes page. On that page, you can select the runtime (application server) your application will use.

By the way, this is actually an Eclipse (IDE) question, not a Servlet question. If you continue to have problems, you should begin your own Topic in the IDE forum.

Good luck.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic