论坛首页 入门技术论坛

servlet小例子

浏览 3721 次
该帖已经被评为新手帖
作者 正文
   发表时间:2009-02-01  

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

   发表时间:2009-02-22  
恩 基本的例子
0 请登录后投票
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics