Results 1 to 7 of 7
  1. #1
    OriginalUtter is offline Member
    Join Date
    Jun 2012
    Posts
    3
    Rep Power
    0

    Default How do i use a web-hosted file as a regular local file?

    Hi all!

    I'm pretty new to JAVA and right now I'm writing a simple Applet where i need to store some data to a file.
    I'm using the NetBeans IDE (NB) and in my project folder I created a simple .txt-file to write to, this works when I
    run the .java file in NB but not when I generate an HTML-file which embedds the applet. So my question is, can you
    work with a file resource this way when it comes to Applets? If not, how do I work with a web-hosted file (URL) to read
    and write in the same way as with local files?

    //OriginalUtter

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default Re: How do i use a web-hosted file as a regular local file?

    It would need to be a signed applet if you want to be able to write to something on the client system.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    OriginalUtter is offline Member
    Join Date
    Jun 2012
    Posts
    3
    Rep Power
    0

    Default Re: How do i use a web-hosted file as a regular local file?

    Quote Originally Posted by Tolls View Post
    It would need to be a signed applet if you want to be able to write to something on the client system.
    I just need to write to the server, how do I do that?

    /OriginalUtter

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default Re: How do i use a web-hosted file as a regular local file?

    Ah, sorry, completely misread that!

    OK, here's a little thought experiment for you.
    Can you write to a file you can only access via http?

    Once you answer that then you have the answer to your question.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    758
    Rep Power
    8

    Default Re: How do i use a web-hosted file as a regular local file?

    You need a hand from a servlet to implements something like this. A servlet can access the files and modify them to your need. So make your applet to call the servlet and ask it to perform some task related to the file that you want to modified on the server.

  6. #6
    OriginalUtter is offline Member
    Join Date
    Jun 2012
    Posts
    3
    Rep Power
    0

    Default Re: How do i use a web-hosted file as a regular local file?

    Maybe it's easier to understand what I'm after if I explain a little more detailed about my problem.

    The thing is that I have developed an Applet which i intend to embed in a webpage. This applet
    allows users to enter strings and hit a 'send' button. This is where I want to collect the input string
    and store it somewhere where I can read from later.

    The applet it pretty much done except for the storing of input strings,
    what is the smoothest way to do this?

    Some guys have mentioned Servlets here, is that the best way to go?
    If so, where do I start, what do I need to do? What is a Servlet?

    //OriginalUtter

  7. #7
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default Re: How do i use a web-hosted file as a regular local file?

    You could use PHP.
    Essentially, if you want to store it on the web, then you need some code on the site the applet came from (applet security rules etc) that will accept the data and store it. It doesn't matter what that code is written in.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 3
    Last Post: 11-09-2011, 02:51 PM
  2. Replies: 9
    Last Post: 08-16-2011, 04:41 PM
  3. Accessing Local File
    By jstys92 in forum Java Applets
    Replies: 7
    Last Post: 06-17-2011, 04:35 PM
  4. upload file from local system to database
    By harsha.udupa2008 in forum Advanced Java
    Replies: 3
    Last Post: 09-17-2010, 08:58 AM
  5. Local file access
    By joe_coolish in forum Java Applets
    Replies: 1
    Last Post: 02-18-2010, 01:51 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •