Submitted Work
Internet Explorer appears to lose the data from a form if any
new text is written to the same document by an 'onSubmit' handler.
The handler for this version creates the 'thank you' message
in a new window.
The following alternatives are earlier attempts at the coursework which handle form submission differently and also request a postal address instead of an e-mail address.
Alternative 1: onSubmit
This version uses an 'onSubmit' handler to process form data
and then thank the user in the same window.
Alternative 2: onClick
This version uses an 'onClick' handler to process form data.
and then thank the user in the same window.
Write a Client application which consists of a GUI containing a field accepting input from the user, a field showing the status of the connection and the reply from the server. The transmission must be triggered by clicking on a 'Transmit' button. There should also be a 'Quit' button.
My solution to this coursework consists of the following files:
Application Files:
EchoClient.java - Echo-client program EchoServer.java - Echo-server programLibrary Class Files:
AppWindow.java - Closeable application window MessageArea.java - Read-only subclass of TextArea MessageField.java - Read-only subclass of TextFieldBy default, both programs use port 9999 and the EchoClient program uses the host 127.0.0.1 (loopback) to connect to an EchoServer. These defaults can be modified by using command-line parameters to specify an alternative host and/or port. Details on how to do this are written to the standard-output when each program begins.
For this coursework I have implemented a web-page hit-counter using Remote Method Invocation. The coursework consists of some Java source files and an HTML file. The Java source files are grouped into a package called hitter.
Application Files:
HitCounter.java - RMI Interface HitServer.java - RMI Server HitApplet.java - RMI Client Applet (Hit-Counter) DateApplet.java - RMI Client Applet (Hits-Log Creation Date)Library Class Files:
PropertySet.java - Class used to implement hit-counter log-files Lib.java - Small library of general-purpose static methodsHTML Activation File:
hitter.html - An HTML page that activates the two appletsYou can display the hitter.html file but the applets on the page will fail because they are unable to contact an RMI server. The RMI package supplied with current release of the Sun JDK (1.1x) does not provide facilities for remote activation of an RMI server. This means that there must be a process running continuously on the server host to monitor for RMI requests. The upcoming release of the JDK (1.2) does apparently include support for remote activation of an RMI server. Roll-on v1.2!
The HitServer RMI server provides two remote methods via the HitCounter interface. One, getHits(), simply returns an integer representing the number of hits for a given URL and is used by the HitApplet applet. The other remote method, getInfo(), returns a HitCounter.Info object which contains extra information about the hits-log kept by the server and is used by the DateApplet applet to display the creation date of the log.
The PropertySet class extends java.util.Properties to add methods for reading and writing named sets of properties within a single file. These PropertySet files use a format similar to that used for Windows .INI files.