Oh... PrintWriter out = response.getWriter() not res.getWriter(), also 
it's not tested :)



>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 2/5/01, 9:46:50 AM, "John Golubenko" <[EMAIL PROTECTED]> 
wrote regarding Re: Off topic - HTTP POST example?:


> Well, do you mean POST from web-form? Then it would be:

> <form name="posttest" action="http://server/servlet/ServletName"
> method="POST">
> Name: <input type="text" name="name">
> <input type="submit">
> </form>


> If you asking how to handle POST's from a servlet, it would be:

> import javax.servlet.*;
> import javax.servlet.http.*;

> public class ServletName extends HttpServet {
>       public void doPost(HttpServletRequest request, HttpServletResponse
> response)
>               throws ServletException, IOException {
>               response.setContentType("text/html");
>             PrintWriter out = res.getWriter();
>             String name = request.getParameter("name");
>               out.println("The parameter name = " + name);
>       }
>       /* Also you can redirect POST<->GET methods by doing this: */
>       public void doGet(HttpServletRequest request, HttpServeltResponse
> response) {
>               doPost(request, response);
>       }
> }


> That's about it. To secure it, just put this stuff under secure section
> of your site.
> Or request it thru secure https protocol.
> Good luck,
> John.




> >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

> On 2/5/01, 9:28:32 AM, "David Wall" <[EMAIL PROTECTED]> wrote regarding
> Off topic - HTTP POST example?:


> > Not exactly a Tomcat issue, but it's in the web world of Java servlets:

> > Does anybody have any code samples that would demonstrate an HTTP POST
> (I'll
> > use JSSE and really do an HTTPS POST, but I suspect the code will be the
> > same or very similar)?  I've seen URL class code that does a GET, but
> > nothing that shows how to setup the HTTP body parts and encoding that go
> on
> > in a POST.

> > Thanks,
> > David


> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, email: [EMAIL PROTECTED]

> NOTICE:  This communication may contain confidential or other privileged 
information.  If you are not the intended recipient, or believe that you 
have received this communication in error, please do not print, copy, 
retransmit, disseminate, or otherwise use the information.  Also, please 
indicate to the sender that you have received this email in error, and 
delete the copy you received.  Any communication that does not relate to 
official Columbia business is that of the sender and is neither given nor 
endorsed by Columbia.  Thank you.



> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]


> NOTICE:  This communication may contain confidential or other privileged 
information.  If you are not the intended recipient, or believe that you 
have received this communication in error, please do not print, copy, 
retransmit, disseminate, or otherwise use the information.  Also, please 
indicate to the sender that you have received this email in error, and 
delete the copy you received.  Any communication that does not relate to 
official Columbia business is that of the sender and is neither given nor 
endorsed by Columbia.  Thank you.

NOTICE:  This communication may contain confidential or other privileged information.  
If you are not the intended recipient, or believe that you have received this 
communication in error, please do not print, copy, retransmit, disseminate, or 
otherwise use the information.  Also, please indicate to the sender that you have 
received this email in error, and delete the copy you received.  Any communication 
that does not relate to official Columbia business is that of the sender and is 
neither given nor endorsed by Columbia.  Thank you.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to