You must put the class in a .jar itself located in the WEB-INF/lib
folder of a .war or you must put the class in WEB-INF/classes of a .war
You must also setup your servlet un WEB-INF/web.xml

Then you must deploy you .war in tomcat (the easiest way is to use the
manager: http://tomcat.apache.org/tomcat-5.5-doc/manager-howto.html)

If you don't know what web.xml and what a .war are, i suggest you take a
look at http://java.sun.com/j2ee/tutorial/1_3-fcs/index.html section
about web technology.

Regards

Marc Wentink a écrit :

>My excuses for such a simple question, but the archives are not =
>searchable and the documentation not very clear. Or may-be I am just a =
>terrible newbee.
>
>Say I have a class file that contains a servlet, should not I do =
>something so that tomcat becomes the container of this servlet, and a =
>client browser could call the servlet? I expected to find some "install =
>class file that contains the servlet so Tomcat becomes it container" =
>option somewhere in the management part of Tomcat, but I am lost.
>
>These are my files:
>
>HelloIZ.java:
>
>import java.io.*;
>import javax.servlet.*;
>import javax.servlet.http.*;
>
>public class HelloIZ extends HttpServlet {
>
>    public void doGet(HttpServletRequest request, HttpServletResponse =
>response)
>    throws IOException, ServletException
>    {
>        response.setContentType("text/html");
>        PrintWriter out =3D response.getWriter();
>        out.println("<html>");
>        out.println("<head>");
>        out.println("<title>Hallo IntraZis!</title>");
>        out.println("</head>");
>        out.println("<body>");
>        out.println("<h1>Hallo IntraZis!</h1>");
>        out.println("</body>");
>        out.println("</html>");
>    }
>}
>
>I have got the class file after setting my classpath to servlet.jar and =
>using javac.
>
>And I thought I had to make some html to call the servlet:
>
>StartServlet.html
>
><html>
><head>
><title>Hello Hospital!</title>
></head>
><body>
><a href=3D"./HelloIZExample">go</a>
></body>=09
></html>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to