aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Why I don't have the import javax.servlets.http.*? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Why I don Watch "Why I don New topic
Author

Why I don't have the import javax.servlets.http.*?

Irtiza Ali
Greenhorn

Joined: Nov 27, 2009
Posts: 21


this is my code in eclipse. I am doing the example from the Head First Servlets & JSP book. March 2008.

But its not running because the eclipse cannot find HttpServlet???what could be the reason???my JSP's were perfectly running. I have Eclipse Java EE IDE for Web Developers. Do I have to add any libraries before making the first servlet???

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

Please be sure to ask IDE questions in the IDEs forum. I have moved this post there for you.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Irtiza Ali
Greenhorn

Joined: Nov 27, 2009
Posts: 21
Sorry.

I thought the ever was because I was trying to write my first servlet. Still anyone who knows what could be the problem with my IDE?

Irtiza
Irtiza Ali
Greenhorn

Joined: Nov 27, 2009
Posts: 21
and the error is "HttpServlet cannot be resolved to a type"
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

You have to add servlet-api.jar (i.e., the jar containing the javax.servlet.* classes) to your Eclipse project's build path. These classes aren't part of the standard Java APIs.


[Jess in Action][AskingGoodQuestions]
Irtiza Ali
Greenhorn

Joined: Nov 27, 2009
Posts: 21
Thanks Sir.

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Why I don't have the import javax.servlets.http.*?