Hello Servlet

  import java.io.*;
  import javax.servlet.*;
  import javax.servlet.http.*;

  public class Hello extends HttpServlet{


    public void doGet(HttpServletRequest request, HttpServletResponse response) 
    throws ServletException, IOException {

       response.setContentType("text/html");
       PrintWriter out = response.getWriter();

       String name = request.getParameter("name");

       // Print the HTML header
       out.println("<HTML><HEAD><TITLE>");
       out.println("Hello, " + name);
       out.println("</TITLE></HEAD>");

       // Print the HTML body
       out.println("<BODY>");
       out.println("<BIG>Hello ," + name + "</BIG>");
       out.println("</BODY></HTML>");
    }
  }

[ Seminar Linux und Apache ] [zurück]