Bo Xu wrote:
>
> In a applet,  I want to "invoke:-)" a servlet(my_servlet.class):
>
> 1.
> if I use "http://IPAddr:port/servlet/my_servlet" to make a "URL",  then in
> my_servlet, "doGet" is "invoke".
>
> 2.
> if I use "http://IPAddr:port/servlet/my_servlet?ParamName=..." to make a URL,
> then in my_servlet, "doGet" is "invoke"
>
> So:
> How can I make a URL to "invoke doPost" ?  If I use "FORM(HTML)", I know how to
> "invoke doPost",  But I don't know how to use "URL" to "invoke doPost".

You need to send information in the header that tells the server that this is a
POST request. I am assuming that you are using the URLConnection class. After
getting an instance of that class, call
URLConnection.setRequestProperty("CONTENT-TYPE",
"application/x-www-form-urlencoded"). The other header you might need to set is
"REQUEST_METHOD" with a value of "POST".

More information on how to do this is in example 10-4 of Java Servlet
Programming, Hunter and Crawford, O'Reilly  1998 (http://www.servlets.com)

K Mukhar

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to