Solved

Java Programming question

Posted on 1997-06-27
3
189 Views
Last Modified: 2010-05-18
I've made an simple applet which stores a mail address inputted fron the user. Then it writes the address to a file "maillist.txt", this goes perfectly when I use the random access method on my local machine, but as this is a applet, I should use an URL to save the information.
Then the problem is there are no random access methods in the URL package. Are there any workarounds for this, other than reading the whole datafile into the applet?
0
Comment
Question by:olavb
3 Comments
 

Expert Comment

by:weka
ID: 1222328
One way to go about this is to have a servlet handle the writing to the maillist.txt file server-side.  The servlet can use a random access method.  Then you just communicate with the servlet and send the data.  You can use a number of solutions for client-server-side communication including sockets in the java.net library, RMI, APIs like NSAPI and ISAPI (I believe) or a number of other tool based solutions.  Your choice is dependent on whether or not their is going to be more functionality that might be hosted server-side in the future.

- Weka
0
 
LVL 6

Expert Comment

by:jpk041897
ID: 1222329
Another posibility is to set up a complete server application on the server. And follow up on weka's advise.

The use of a Server or a Servlet would depend on the ammount of trafic you are expecting to handle. For small loads, servlets work fine. For high trafic, full server apps are better since they don't have to be reloaded each time a request is processed.


One final alternative, albeit more work, is to use JDBC and a data base. You could then make the requests dirrectly from the client and avoid a server/servlet solution. But this would imply using a straight JDBC driver, not and ODBC bridge, since a bridge would imply installing an ODBC driver on the client box.
0
 

Accepted Solution

by:
istiles earned 0 total points
ID: 1222330
If server side components do not interest you, there is another way...use a protocol other than HTTP that most likely the server already has support for--NFS or FTP.

Jentec makes a product that run-time determines what protocol to use to communicate with a server to allow file I/O, printing, and email support. The product is called JENI (Java Enterprise Network Interface) and currently supports NFS, FTP, LDAP, POP, SMTP, as well as local support. You write once to the JENI interface and JENI handles the differences between protocols and local access for you.

JENI provides an equivalent class for random access called "RandomAccessStream" which will work on the network or locally dynamically. You may use this class to open, seek to the end, and write your mail list information.

Another option is to use JENI to send an email message with the mail list information enclosed if you don't have other file I/O protocols loaded on your web server.

Hope this helps,

Ian Stiles
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now