You've got a couple of choices.
You can use RMI or CORBA (IIOP), going outside the HTTP protocol, if the files
are big. In your case, this sounds like overkill. You can also encode the
items into POST variables using URLConnection or HttpURLConnection. To do this,
do something like:
URL url = new URL(myURL);
HttpURLConnection urlConn = (HttpURLConnection)url.openConnection();
urlConn.setDoOutput(true);
urlConn.setRequestMethod("POST");
After this, you must create your own writer for the output stream of the
URLConnection:
PrintWriter httpOutput = new PrintWriter(new
OutputStreamWriter(urlConn.getOutputStream()));
Then, for each item you wish to output (you can encode the entire file into one
item), you must write out the items like so:
httpOutput.print(URLEncoder.encode("VAR_NAME_1") + "=" +
URLEncoder.encode(var1) + "&");
httpOutput.print(URLEncoder.encode("VAR_NAME_2") + "=" +
URLEncoder.encode(var2));
Between each item, you must write out an "&". The encode() method encodes text
for the HTTP protocol. The text is automatically decoded on the other side.
All you need to do is write a CGI script or a servlet that accepts POST forms.
You can then look up the items as you have named them above (i.e. "VAR _NAME_1"
and "VAR_NAME_2").
I hope that helps.
-dan
Gustavo Medina del Rosario wrote:
> Hi:
>
> My name is Guss and I write from Spain, so sorry for my poor
> english.
>
> I am trying to write e file in a server from an applet. My applet
> ask some questions to the user (name, address, etc.) and proccess the
> information and I want it to write in the server (where the applet is
> stored) in a text file.
>
> Some people in spain emailed me that it can be made with the URL
> class but I can't.
>
> Thank you.
>
> Guss
>
> ----------------------------------------------------------------------
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]