Hi,

If follow your code right then I think you are missing a call to
HttpURLConnection.setRequestMethod("POST");

Could this be it?

--Amos Shapira
WebCollage

> -----Original Message-----
> From: Thanasis Papakostas [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 28, 2000 5:07 PM
> To: [EMAIL PROTECTED]
> Subject: Applet-servlet again!
>
>
> I want to call the doPost and doGet methods of a servlet from
> an applet
> and pass some parameters with it.
> I'm using a class to do the job.I call the
> sendMessage(Properties, int)
> method of the class
>
> public InputStream sendMessage(Properties args, int method) throws
> IOException {
>
>         if (method == GET) {
>
>             URL url = new URL(servlet.toExternalForm() + "?" +
> toEncodedString(args));
>
>             return url.openStream();
>
>         } else {
>
>             URLConnection conn = servlet.openConnection();
>
>          conn.setDoInput(true);
>             conn.setDoOutput(true);
>             conn.setUseCaches(false);
>
>      // Work around a Netscape bug
>
> conn.setRequestProperty("Content-Type","application/x-www-form
> -urlencoded");
>
>
>
>             // POST the request data (html form encoded)
>
>      DataOutputStream out = new
> DataOutputStream(conn.getOutputStream());
>
>      if (args != null && args.size() > 0) {
>
>   out.writeBytes(toEncodedString(args));
>       }
>             out.flush();
>             out.close();
>
>          // Read the POST response data
>
>             return conn.getInputStream();
>
>         }
>     }
>
> However i don't seem to be able to invoke the doPost method.
> Can anyone
> help me?
>
> ______________________________________________________________
> _____________
> 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

___________________________________________________________________________
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