FileDocCategorySizeDatePackage
EchoArgs.javaAPI DocExample1512Mon Oct 16 19:44:06 BST 2000None

EchoArgs

public class EchoArgs extends HttpServlet

Fields Summary
Constructors Summary
Methods Summary
public voiddoGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)

	res.setContentType( "text/html" );
  	   PrintWriter out = res.getWriter();
  	
  	   out.println( "<html>" );
  	   out.println( "<head>" );
  	   out.println( "<title>Echo arguments</title>" );
  	   out.println( "</head>" );
  	   out.println( "<body>" );
      out.println( "<h1>Arguments sent using GET:</h1>" );
  	
  	   dumpArgs( req, out );

	   out.println( "</body>" );
  	   out.println( "</html>" );
      out.close();
   
private voiddumpArgs(javax.servlet.http.HttpServletRequest req, java.io.PrintWriter out)

	Enumeration names = req.getParameterNames();
		while( names.hasMoreElements() )
		{	String key;
			key = (String)names.nextElement();
			// value = req.getParameter( key );
			// out.println("Key: " + key + " Value: " + value + "<BR>" );
			String[] values;
			values = req.getParameterValues( key );
			out.print( "<P>Key: " + key + "<BR>" );
			out.print( "Values: ");
			for( int i = 0; i < values.length; i++ )
			{  out.print( values[i] + ", " );
			}
			out.println( "</P>" );
		}
	
public voidinit(javax.servlet.ServletConfig config)

	super.init( config );