aspose file tools*
The moose likes Servlets and the fly likes Sending data from Applet to CGI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Sending data from Applet to CGI" Watch "Sending data from Applet to CGI" New topic
Author

Sending data from Applet to CGI

Mark Sievers
Greenhorn

Joined: Aug 14, 2001
Posts: 2
OK, here's my problem:
I wrote an Applet in which you can manipulate Images. Now I want the Applet to send back the BufferedImage back to the Server. I do not want to use servlets due to usage of tomcat, so I want to post the data to a PHP-Script. Is this possible? I opened a new URLconnction to the Server, but it didn't work to post data. Any help would be appreciated...
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

You should be able to post data from an Applet to a PHP server as long as you make a valid HTTP session out of it. Your only limitation is that the PHP server be the same machine that the applet was loaded from (standard Java sandbox limitation).


Customer surveys are for companies who didn't pay proper attention to begin with.
Mark Sievers
Greenhorn

Joined: Aug 14, 2001
Posts: 2
HOW???
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

You open a URLConnection inside the applet, send the data, then retrieve the response. I no longer have that source code, but it wasn't very difficult - I used the O'Reilly "Java Examples in a Nutshell" network programming chapter as a guide. They have the sample network source code on their website (http://www.ora.com)
Also, look through the recent messages here - some good starter code is in one of them.
[This message has been edited by Tim Holloway (edited August 16, 2001).]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Sending data from Applet to CGI