import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
public class MyServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {
System.out.println("command: "+request.getParameter("command"));
response.setContentType("text/html");
java.io.PrintWriter out = response.getWriter();
out.println("");
out.println("Help Page ");
out.println("Please submit your information
");
out.println("");
out.println("");
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException,java.io.IOException{
Enumeration paramNames = request.getParameterNames();
String parName;
boolean emptyEnum = false;
if (! paramNames.hasMoreElements())
emptyEnum = true;
response.setContentType("text/html");
java.io.PrintWriter out = response.getWriter();
out.println("");
out.println("Submitted Parameters ");
if (emptyEnum){
out.println("Sorry, the request does not contain any parameters
");
} else {
out.println("Here are the submitted parameter values
");
}
while(paramNames.hasMoreElements()){
parName = (String) paramNames.nextElement();
out.println("" + parName + " : " + request.getParameter(parName));
out.println("
");
}
out.println("");
}
}
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
MyServletName
MyServlet
MyServletName
/*