You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by athula bogoda <at...@yahoo.com> on 2006/12/28 13:16:36 UTC

Help Me on Servlet in Tomcat 5.0

Hi All,

Can any body give me guidence to run my first servlet
on Tomcat 5.0. 
This is my file...

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class HelloWorld extends HttpServlet {

    public void doGet(HttpServletRequest request,
HttpServletResponse response)
    throws IOException, ServletException
    {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        out.println("<html>");
        out.println("<head>");
        out.println("<title>Hello World!</title>");
        out.println("</head>");
        out.println("<body>");
        out.println("<h1>Hello World!</h1>");
        out.println("</body>");
        out.println("</html>");
        
    }
}
 

I compiled it(windows environment). But confused where
should i should put it and run on my local machine
typing http://localhost/

I go through several tutorials.But could not able to
success.If any one can help me it would be agreat
help.

Thanks.
Athula.

Send instant messages to your online friends http://uk.messenger.yahoo.com 

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Help Me on Servlet in Tomcat 5.0

Posted by Dinesh Kumar <di...@denabank.co.in>.
> Try this link, they have some good tutorials:
> http://www.coreservlets.com/Apache-Tomcat-Tutorial/
> 

THIS LINK IS GOOD

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Help Me on Servlet in Tomcat 5.0

Posted by EDMOND KEMOKAI <ek...@gmail.com>.
Try this link, they have some good tutorials:
http://www.coreservlets.com/Apache-Tomcat-Tutorial/

On 12/28/06, athula bogoda <at...@yahoo.com> wrote:
>
> Hi All,
>
> Can any body give me guidence to run my first servlet
> on Tomcat 5.0.
> This is my file...
>
> import java.io.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
>
> public class HelloWorld extends HttpServlet {
>
>     public void doGet(HttpServletRequest request,
> HttpServletResponse response)
>     throws IOException, ServletException
>     {
>         response.setContentType("text/html");
>         PrintWriter out = response.getWriter();
>         out.println("<html>");
>         out.println("<head>");
>         out.println("<title>Hello World!</title>");
>         out.println("</head>");
>         out.println("<body>");
>         out.println("<h1>Hello World!</h1>");
>         out.println("</body>");
>         out.println("</html>");
>
>     }
> }
>
>
> I compiled it(windows environment). But confused where
> should i should put it and run on my local machine
> typing http://localhost/
>
> I go through several tutorials.But could not able to
> success.If any one can help me it would be agreat
> help.
>
> Thanks.
> Athula.
>
> Send instant messages to your online friends http://uk.messenger.yahoo.com
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
"talk trash and carry a small stick."
PAUL KRUGMAN (NYT)

RE: Help Me on Servlet in Tomcat 5.0

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: athula bogoda [mailto:athula.bogoda@yahoo.com] 
> Subject: Help Me on Servlet in Tomcat 5.0
> 
> But confused where should i should put it and run 
> on my local machine typing http://localhost/

1) Read the servlet spec:
http://jcp.org/aboutJava/communityprocess/final/jsr154/index.html

2) Read the Tomcat deployment doc:
http://tomcat.apache.org/tomcat-5.0-doc/appdev/deployment.html

3) Suggest using 5.5.20, not an outdated version of Tomcat.

4) Declare your class to be part of some package.

5) If you want this servlet to be part of the default webapp, it must be
placed in webapps/ROOT, either in a .jar in webapps/ROOT/lib or as a
.class file under webapps/ROOT/classes.

6) Define the appropriate servlet mapping in
webapps/ROOT/WEB-INF/web.xml.

7) Reconfigure the HTTP connector in conf/server.xml to use port 80
rather than the Tomcat default of 8080.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org