package forms; import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; import org.apache.ecs.*; import org.apache.ecs.html.*; /** * A servlet to demonstrate the use of parameters in HTML forms. * It also uses ECS to format the results. * * @version 1.0 2001/08/15 * @author Mike Gehard */ public class Parameters2 extends HttpServlet{ /** * Handle POST request. * 1) Reads all request parameters and prints them out to the screen * 2) Use element construction set (ECS) to format results * * @param request the HTTPServletRequest associated with this servlet * @param response the HTTPServletResponse associated with this servlet * @throws ServletException * @throws IOException * */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ response.setContentType("text/html"); PrintWriter out = response.getWriter(); Table table = new Table(0); // border = 0 // create the HTML tree Html html = new Html(); Head head = new Head(); Title title = new Title("Parameters with ECS"); Body body = new Body(); head.addElement(title); body.addElement(table); html.addElement(head); html.addElement(body); /* This gets replaced with the above code out.println(""); out.println("
| " + name + " | " + values[i] + " |