markt 2005/01/04 14:47:39 Modified: webapps/examples/servlets reqparams.html Log: Fix bug 6582. Align example source code with what is actually in the servlet. Revision Changes Path 1.2 +30 -8 jakarta-tomcat-4.0/webapps/examples/servlets/reqparams.html Index: reqparams.html =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/examples/servlets/reqparams.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- reqparams.html 17 Aug 2000 00:58:20 -0000 1.1 +++ reqparams.html 4 Jan 2005 22:47:39 -0000 1.2 @@ -21,19 +21,41 @@ { response.setContentType("<font color="#009900">text/html</font>"); PrintWriter out = response.getWriter(); - out.println("GET Request. No Form Data Posted"); + out.println("<font color="#009900"><html></font>"); + out.println("<font color="#009900"><head></font>"); + out.println("<font color="#009900"><title>Request Parameters Example</title></font>"); + out.println("<font color="#009900"></head></font>"); + out.println("<font color="#009900"><body></font>"); + out.println("<font color="#009900"><h3>Request Parameters Example</h3></font>"); + out.println("<font color="#009900">Parameters in this request:<br></font>"); + if (firstName != null || lastName != null) { + out.println("<font color="#009900">First Name:</font>"); + out.println("<font color="#009900"> = </font>" + HTMLFilter.filter(firstName) + "<font color="#009900"><br></font>"); + out.println("<font color="#009900">Last Name:</font>"); + out.println("<font color="#009900"> = </font>" + HTMLFilter.filter(lastName)); + } else { + out.println("<font color="#009900">No Parameters, Please enter some</font>"); + } + out.println("<font color="#009900"><P></font>"); + out.print("<font color="#009900"><form action=\"</font>"); + out.print("<font color="#009900">RequestParamExample\" </font>"); + out.println("<font color="#009900">method=POST></font>"); + out.println("<font color="#009900">First Name:</font>"); + out.println("<font color="#009900"><input type=text size=20 name=firstname></font>"); + out.println("<font color="#009900"><br></font>"); + out.println("<font color="#009900">Last Name:</font>"); + out.println("<font color="#009900"><input type=text size=20 name=lastname></font>"); + out.println("<font color="#009900"><br></font>"); + out.println("<font color="#009900"><input type=submit></font>"); + out.println("<font color="#009900"></form></font>"); + out.println("<font color="#009900"></body></font>"); + out.println("<font color="#009900"></html></font>"); } <font color="#0000FF">public void</font> doPost(HttpServletRequest request, HttpServletResponse res) <font color="#0000FF">throws</font> IOException, ServletException { - Enumeration e = request.getParameterNames(); - PrintWriter out = res.getWriter (); - while (e.hasMoreElements()) { - String name = (String)e.nextElement(); - String value = request.getParameter(name); - out.println(name + "<font color="#009900"> = </font>" + value); - } + doGet(request, response); } }</pre> </body>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]