Java Reference
In-Depth Information
Example 18.1 A “Hello, world” servlet
/*
* HiServlet.java
*/
package net.multitool.servlet;
import javax.servlet.*;
import javax.servlet.http.*;
/**
* Simple Servlet that generates a page of HTML
*/
public class
HiServlet
extends HttpServlet
{
/**
* Think of this as the constructor for the servlet.
* We need do nothing for our example,
* but we should call our parent object.
*/
public void
init(ServletConfig config)
throws ServletException
{
super.init(config);
} // init
/**
* Called when the Web server is shutting down
* or wants to shut down this particular servlet.
* We need do nothing.
*/
public void
destroy()
{
} // destroy
/**
* Handles the HTTP GET method.
* @param request servlet request
* @param response servlet response
*/
Search WWH ::




Custom Search