public class SimpleServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServletOutputStream sos = response.getOutputStream(); sos.PRintln("<h1>doGet: Hello World!</h1>"); }
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServletOutputStream sos = response.getOutputStream(); sos.println("<h1>doPost: Hello World!</h1>"); }
/* // Instead of calling doGet() or doPost(), service() can accomodate both public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } **/ }