aspose file tools*
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


Win a copy of Soft Skills this week in the Jobs Discussion forum!
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: 61760
    
  67

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: error: package javax.servlet does not exist