Sample Servlet
public SampleServlet implements Servlet {
private ServletConfig config;
public void init (ServletConfig config)
throws ServletException {
public void destroy() {} // do nothing
public ServletConfig getServletConfig() {
public String getServletInfo() {
return "A Simple Servlet";
public void service (ServletRequest req,
) throws ServletException, IOException {
res.setContentType( "text/html" );
PrintWriter out = res.getWriter();
out.println( "<title>A Sample Servlet</title>" );
out.println( "</head>" );
out.println( "<h1>A Sample Servlet</h1>" );
out.println( "</body>" );
out.println( "</html>" );