CS381 - Lab Session 5
A. Creating a ‘Hello world’ servlet
1. Using “nedit” or “notepad” or your tool of choice, create the following servlet:
package webtech;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
/** a simple servlet */
public class HelloWorld extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType(“text/html”);
PrintWriter out = response.getWriter();
String docType =
“\n”;
out.println(docType +
“\n” +
“Servlet example\n” +
“Hello world
\n” +
“