To Deploy a Servlet using Tomcat
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   RAM_KUMAR
Posted On:   Monday, June 16, 2003 03:52 AM

I am trying to deploy an example servlet in tomcat. my example servlet code is import javax.servlet.http.*; import javax.servlet.*; import java.io.*; public class HitServlet extends HttpServlet { private int mCount; public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String message = "Hits: " + ++mCount; response.setContentType("text/plain"); response.setContentLength(message.length()); PrintWriter out = response.getWriter(); out.println(message); } } i 've placed my se   More>>

I am trying to deploy an example servlet in tomcat.


my example servlet code is

import javax.servlet.http.*;

import javax.servlet.*;

import java.io.*;

public class HitServlet extends HttpServlet {

private int mCount;

public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

String message = "Hits: " + ++mCount;

response.setContentType("text/plain");

response.setContentLength(message.length());

PrintWriter out = response.getWriter();

out.println(message); } }


i 've placed my servlet in the directory


webapps/midp/WEB-INF/classes/HitServlet.java


i've successfully compiled the code. Then started the tomcat server & thro' IE tried to open the url


to http://localhost:8080/midp/hits.


but i 'm receiving the error the servlet bob is missing. i've placed the web.xml & server.xml in the folders specified in the tutorial. in server.xml i've added the code




web.xml


<?xml version="1.0" encoding="ISO-8859-1"?>




bob

HitServlet



bob

/hits




If u can guide me to deploy the servlet it'll be very helpfull.


With Best Regards


Ramkumar

   <<Less
About | Sitemap | Contact