Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Irtiza Ali
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Pie
Posts: 64633
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to ask IDE questions in the IDEs forum. I have moved this post there for you.
 
Irtiza Ali
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and the error is "HttpServlet cannot be resolved to a type"
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Irtiza Ali
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Sir.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic