The Artima Developer Community
Sponsored Link

Java Answers Forum
How to write to file on server from Applet

7 replies on 1 page. Most recent reply: Oct 30, 2002 3:12 PM by Markus Weigert

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 7 replies on 1 page
Markus Weigert

Posts: 9
Nickname: weigi
Registered: Jul, 2002

How to write to file on server from Applet Posted: Aug 9, 2002 1:12 AM
Reply to this message Reply
Advertisement
Sun says, an applet is able to read and write
files to the place from where it was loaded!

What I want to do now is to write a file there!!!!!
But how can I do that if my applet is on some remote
server (Aol) and I only know the URL!
So, how can I create a file there?
I can't create a file object to this place cause
it only allows Strings for construction (no URL)
and I think it only works locally!
Writing to URL may also fail!
So what to do?

Has anybody done that or can anyone help me with
that?

Regards,
Markus


Andreas Novak

Posts: 3
Nickname: andy
Registered: Aug, 2002

Re: How to write to file on server from Applet Posted: Aug 10, 2002 6:57 AM
Reply to this message Reply
applets are executed on the client therefore you'll need a server side component like a java servlet or a kind of script ( php,cgi,... ) on the machine where the applet came from.
Depending on the size of information to be stored in the file you can use HTTP Post / GET Communication or serialized objects.

P.S.: why not using a database? check out www.mycgiserver.com a free provider which hosts java architecture on the serverside including a database ( Hypersonic and Instantdb I think... )

Regards
Andy

Jay Kandy

Posts: 77
Nickname: jay
Registered: Mar, 2002

Re: How to write to file on server from Applet Posted: Aug 12, 2002 6:39 AM
Reply to this message Reply
Thats an interesting question! I never tried hosting an applet on AOL thingy and read/write a file from there. Does it matter?

Markus Weigert

Posts: 9
Nickname: weigi
Registered: Jul, 2002

Re: How to write to file on server from Applet Posted: Aug 12, 2002 1:49 PM
Reply to this message Reply
Yes Jay,
it matters cause
I didn't find a way to write a file there!
I think that can't be done that way.
Unfortunately I also can't use a servlet or
jsp thing because I know less about the server.
Perhaps I must go the hard way and communicate
with the aol upload page although I have no idea
how to do that.

Regards,
Markus

Markus Weigert

Posts: 9
Nickname: weigi
Registered: Jul, 2002

Re: How to write to file on server from Applet Posted: Aug 12, 2002 1:55 PM
Reply to this message Reply
I now had a look to mycgiserver.com
and it looks promising!

Thank you for the tip,
Andreas!

Greetings,
Markus

Jay Kandy

Posts: 77
Nickname: jay
Registered: Mar, 2002

Re: How to write to file on server from Applet Posted: Aug 13, 2002 9:26 AM
Reply to this message Reply
Hey! when you said AOL, I was thinking in terms of IP assignment. Which means your host address keeps changing (I think). I donot know a THING about AOL and dont hold me for the above! But heres what I know:

As long as you have the IP of your host, (where the applet is located) it is possible to read/write a file on it. And you wouldnt need CGI or a servlet to do that. Please search this forum for solutions. I posted one recently.

Also, please do post the soulution that worked for you, so we dont have to "discover" solutions again.

Thanks,
Jay

Ashley

Posts: 2
Nickname: webfort
Registered: Sep, 2002

Re: How to write to file on server from Applet Posted: Sep 30, 2002 9:20 AM
Reply to this message Reply
Hi, I was wondering if you could help me, I am trying to do the same thing. I have designed a database that connects to a database. This database is a simple text file. I can write and read from it locally on my machine but when I come to run it on my server it does not work. If you could help me it would be much appreciated. My email address is ashley@a-brazier.co.uk

Thanks In Advance

Markus Weigert

Posts: 9
Nickname: weigi
Registered: Jul, 2002

Re: How to write to file on server from Applet Posted: Oct 30, 2002 3:12 PM
Reply to this message Reply
Hi again!

@ Jay Candy:
I didn't need to deal with IP Adresses
at AOL because I tried to use a server - URL to write to.
Also, I didn't figure out how to write a file from
the applet.
Instead I use a servlet to do that now (much easier).

Greets,
Markus

Flat View: This topic has 7 replies on 1 page
Topic: Differece between Class.forName() and new Previous Topic   Next Topic Topic: help me ..

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use