import java.servlet.*; import java.io.*; import java.util.*; import java.servlet.http.*; import java.lang.*; public class example_1 extends GenericServlet { // Service is the function that gets called when a users wants // to load the servlet. //-------------------------------------------------------- // The function receives 2 things, a request and response variable. // - ServletRequest has a bunch of information such as host and client // configuration as well as HTTP connection information // - ServletResponse gives the servlet a way to build a web page // into the user's browser. public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { res.setContentType("text/html"); PrintStream out = new PrintStream(res.getOutputStream()); out.println(""); out.println("BigDave Test Servlet"); out.println(""); out.println("

Congratulations!

"); out.println("Call me pager."); out.println("

Some other data stuff:

"); Date today = new Date(); out.println("
The current date is: " + today.toString()); out.println("
"); out.println("Return to pager page"); out.println(""); } public String getServletInfo() { return "BigDave test java servlet"; } }