Hi all
i am trying  to implement the simple servlet examples .
my environnment is
 linux 2.2.5 , jdk 1.1.7B  pentium 133 Mhz
Here is the source code
Each time i compile it i get message errors telling me that Httpservlet classes are not recognized
Can anybody please tell me what is wrong in the following servelet code

import java.io.*;
import java.servlet.*;
import javax.servlet.*;
 
public class SimpleServlet extends HttpServlet {
 
   
   public void doGet(HttpServletRequest request,HttpServletResponse response)
               throws ServletException,IOException
       {
         PrintWriter out;
         String title = "Simple Servlet Output";
 
     /* set content type and other response header fields first */
 
        response.setContentType("text/html");
 
     /* write the data of the response */
 
        out = response.getWriter() ;
        out.println("<HTML><HEAD><TITLE>");
        out.println(title);
        out.println("</TITLE></HEAD><BODY>");
        out.println("<H1>" + title + "</H1>");
        out.println("<P>This is output from simple Servlet.");
        out.println("</BODY></HTML>");
        out.close();
      }
  }
 
 
Here the result of compilation :
600 servlets]# javac SimpleServlet.java
SimpleServlet.java:5: class HttpServlet not found in class SimpleServlet
public class SimpleServlet extends HttpServlet {
                                   ^
SimpleServlet.java:7: class HttpServletRequest not found in class SimpleServlet
   public void doGet(HttpServletRequest request,HttpServletResponse response)
                     ^
SimpleServlet.java:7: class HttpServletResponse not found in class SimpleServlet
   public void doGet(HttpServletRequest request,HttpServletResponse response)
                                                ^
3 errors
[root@bcm600 servlets]#
 
 
Each time i compile it whith javac it still reject HttpServlet ,HttpservletRequest and HttpServletResponse  classes while as you can
see i have included javax.servlet.*  import line .  can someone tell me What is the problem exactly
 
Thank in advance .

 
 
 
 
 
 
 
 
 

                                                                              

Reply via email to