Pages

Servlet Example by inheriting the GenericServlet class

package com.javaoneworld.classes;

import java.io.IOException;
import java.io.PrintWriter;
 import java.io.*;
 import javax.servlet.*;

public class MySecondServlet extends GenericServlet{
    public void service(ServletRequest req,ServletResponse res)
            throws IOException,ServletException{

        res.setContentType("text/html");

        PrintWriter out=res.getWriter();
        out.print("<html><body>");
        out.print("<b>second servlet generic servlet</b>");
        out.print("</body></html>");

    }
}

No comments:

Post a Comment