Solved

Java Programming question

Posted on 1997-06-27
3
190 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Android studio getdrawable(int) is deprecated 4 87
Java Timer (static) 9 45
hibernate jars 4 32
Notify sent to other threads in Java 9 16
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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

831 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