/*
 * @(#)SimpleFormServlet.java	1.22 97/05/22
 * 
 * Copyright (c) 1995-1997 Sun Microsystems, Inc. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information of Sun
 * Microsystems, Inc. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Sun.
 * 
 * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
 * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
 * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
 * THIS SOFTWARE OR ITS DERIVATIVES.
 * 
 * CopyrightVersion 1.0
 */

import java.io.*;
import java.util.*;

import javax.servlet.*;
import javax.servlet.http.*;

/**
 * This is an example of a simple FormServlet
 */
public class SimpleFormServlet extends HttpServlet { 

    public void service(HttpServletRequest req, HttpServletResponse res)
	throws IOException
    {
        Enumeration keys;
        String key;
        String value;
        String title;

        res.setContentType("text/html");
        ServletOutputStream out = res.getOutputStream();
        out.println("<HEAD><TITLE> SimpleFormServletOutput  </TITLE></HEAD><BODY>");

        out.println("<h1> SimpleFormServlet Output </h1>");
        out.println("<P>This is output from SimpleFormServlet.\n");
	keys = req.getParameterNames();
	while (keys.hasMoreElements()) {
	    key = (String) keys.nextElement();
	    value = req.getParameter(key);
	    out.println("<P>" + "key: " + key + " equals value: " + value);
	}
	out.println("</BODY>");
    }

    public String getServletInfo() {
        return "A simple form servlet";
    }
}
