快捷搜索:

第一个Servlet

import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;

import java.util.*;

public class HelloServlet1 extends HttpServlet {

public void init(ServletConfig config) throws ServletException {

super.init(config);

}

public void service(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException {

String clientIPAddress = req.getRemoteAddr();

res.setContentType("text/html");

ServletOutputStream out = res.getOutputStream();

out.println("");

out.println("hello,world");

out.println("");

}

}

您可能还会对下面的文章感兴趣: