import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class SimpleServlet extends HttpServlet {
public static final String TITLE = "Test servlet";
//Process the HTTP Get request
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
// get the communication channel with the requesting client
PrintWriter out = response.getWriter();
// get the server identification
String server = getServletConfig().
getServletContext().
getServerInfo();
// write the data
out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">"
+ "<HTML>"
+ "<HEAD>"
+ " <TITLE>" + TITLE + "</TITLE>"
+ " <META NAME=\"Author\" CONTENT=\"" + server + "\">"
+ "</HEAD>"
+ "<BODY BGCOLOR=\"#FFFFFF\">"
+ " <CENTER>"
+ " <H1>" + TITLE + "</H1>"
+ " <H2>Hi, " + server + " is working!</H2>"
+ " <H3>[ local time is <font color='#FF9900'>"
+ new java.util.Date() + "</font> ]</H3>"
+ " </CENTER>"
+ "</BODY>"
+ "</HTML>");
}
}