servlet小例子

web.xml 中加入

<servlet>
		<servlet-name>HelloWorld</servlet-name>
		<servlet-class>com.kong.rd.ivr.memcached.monitor.MemcachedMonitorAction</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>HelloWorld</servlet-name>
		<url-pattern>/servlet/*</url-pattern>
	</servlet-mapping>

 MemcachedMonitorAction.java

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class MemcachedMonitorAction extends HttpServlet {

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

		PrintWriter out = response.getWriter();

		out.println("hello world");

	}
}

 http://localhost/com.kong.rd.ivr.memcachedload/servlet/HelloWorld

你可能感兴趣的:(java,xml,Web,servlet,memcached)