Listing 1. Foo.java
/*
* A simple servlet to demonstrate how we can write
* them inside of Enhydra.
* This servlet will be mapped to the /foo URL.
*/
package atf.presentation;
// Servlet imports
import javax.servlet.*;
import javax.servlet.http.*;
// Standard imports
import java.io.*;
import java.text.*;
import java.util.*;
public class Foo extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
// Get the output stream to STDOUT
PrintWriter out = response.getWriter();
// Print some HTML
out.println("<HTML>");
out.println("<Head><Title>Foo</Title></Head>");
out.println("<Body>");
out.println("<P>Foo</P>");
out.println("</Body>");
out.println("</HTML>");
}
}
Copyright © 1994 - 2018 Linux Journal. All rights reserved.