tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/webapps/examples/servlets reqparams.html
Date Tue, 04 Jan 2005 22:47:39 GMT
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(&quot;<font color="#009900">text/html</font>&quot;);
           PrintWriter out = response.getWriter();
  -        out.println(&quot;GET Request. No Form Data Posted&quot;);
  +        out.println(&quot;<font color="#009900">&lt;html&gt;</font>&quot;);
  +        out.println(&quot;<font color="#009900">&lt;head&gt;</font>&quot;);
  +        out.println(&quot;<font color="#009900">&lt;title&gt;Request
Parameters Example&lt;/title&gt;</font>&quot;);
  +        out.println(&quot;<font color="#009900">&lt;/head&gt;</font>&quot;);
  +        out.println(&quot;<font color="#009900">&lt;body&gt;</font>&quot;);
  +        out.println(&quot;<font color="#009900">&lt;h3&gt;Request Parameters
Example&lt;/h3&gt;</font>&quot;);
  +        out.println(&quot;<font color="#009900">Parameters in this request:&lt;br&gt;</font>&quot;);
  +        if (firstName != null || lastName != null) {
  +            out.println(&quot;<font color="#009900">First Name:</font>&quot;);
  +            out.println(&quot;<font color="#009900"> = </font>&quot;
+ HTMLFilter.filter(firstName) + &quot;<font color="#009900">&lt;br&gt;</font>&quot;);
  +            out.println(&quot;<font color="#009900">Last Name:</font>&quot;);
  +            out.println(&quot;<font color="#009900"> = </font>&quot;
+ HTMLFilter.filter(lastName));
  +        } else {
  +            out.println(&quot;<font color="#009900">No Parameters, Please enter
some</font>&quot;);
  +        }
  +        out.println(&quot;<font color="#009900">&lt;P&gt;</font>&quot;);
  +        out.print(&quot;<font color="#009900">&lt;form action=\"</font>&quot;);
  +        out.print(&quot;<font color="#009900">RequestParamExample\" </font>&quot;);
  +        out.println(&quot;<font color="#009900">method=POST&gt;</font>&quot;);
  +        out.println(&quot;<font color="#009900">First Name:</font>&quot;);
  +        out.println(&quot;<font color="#009900">&lt;input type=text size=20
name=firstname&gt;</font>&quot;);
  +        out.println(&quot;<font color="#009900">&lt;br&gt;</font>&quot;);
  +        out.println(&quot;<font color="#009900">Last Name:</font>&quot;);
  +        out.println(&quot;<font color="#009900">&lt;input type=text size=20
name=lastname&gt;</font>&quot;);
  +        out.println(&quot;<font color="#009900">&lt;br&gt;</font>&quot;);
  +        out.println(&quot;<font color="#009900">&lt;input type=submit&gt;</font>&quot;);
  +        out.println(&quot;<font color="#009900">&lt;/form&gt;</font>&quot;);
  +        out.println(&quot;<font color="#009900">&lt;/body&gt;</font>&quot;);
  +        out.println(&quot;<font color="#009900">&lt;/html&gt;</font>&quot;);
       }
   
       <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 + &quot;<font color="#009900"> = </font>&quot;
+ value);
  -        }
  +        doGet(request, response);
       }
   }</pre>
   </body>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message