This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Servlets and the fly likes error: package javax.servlet does not exist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "error: package javax.servlet does not exist" Watch "error: package javax.servlet does not exist" New topic
Author

error: package javax.servlet does not exist

david allen
Ranch Hand

Joined: Sep 27, 2002
Posts: 185
I am trying to write my first servlet (I have jsp working) Note: I have not downloaded ant???
when I compile it tells me that it cant find javax.servlet. Any ideas. thanks
here is my code
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

class HelloClientServlet extends HttpServlet
{
protected void doGet(HttpServletRequest req,
HttpServletResponse res)
throws ServletException, IOException
{
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println("<HTML><HEAD><TITLE>Hello Client!</TITLE>"+
"</HEAD><BODY>Hello Client!</BODY></HTML>");
out.close();
}
public String getServletInfo()
{
return "HelloClientServlet 1.0 by Stefan Zeiger";
}
}
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63198
    
  69

Be sure that servlet.jar is in your classpath.
hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: error: package javax.servlet does not exist
 
It's not a secret anymore!