import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class SimpleServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { // set header field first res.setContentType("text/html"); // then get the writer and write the response data PrintWriter out = res.getWriter(); out.println(" SimpleServlet Output"); out.println("

SimpleServlet Output

"); out.println("

This is output is from SimpleServlet."); out.println(""); out.close(); } public String getServletInfo() { return "A simple servlet"; } }