IM269: Programming The Internet

Lecturer: Chris Wright


Coursework 1

Write a web page containing a form which allows the user to enter their name, e-mail address and telephone number. On pressing the 'Submit' button, the form should be validated ie. A script should be called which checks each field for appropriate input eg. Numeric, length, null entries. In the event of the fields being inappropriately filled in, the user should be shown an error dialogue, explaining what the problem is and how to solve it. The contents of the form must not be transmitted until the form is correctly filled in. On successful transmission of the form, a page should be generated which thanks the user by name, for their input.


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.


Coursework 2

Write a multi threaded Server application in Java which listens and accepts input on port 9999. It should consist of three classes, one to represent the GUI, one to listen, accept connections and revert to listening, one to handle multiple transactions. The GUI should consist of a TextArea in which the details and status of the server and each connection are displayed. ie. Server listening on Port 9999, IP number of Client, Connection accepted, Number of Connection, Input received and returned and a 'Quit' button.

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 program
Library Class Files:
  AppWindow.java        - Closeable application window
  MessageArea.java      - Read-only subclass of TextArea
  MessageField.java     - Read-only subclass of TextField
By 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.

A WinZip archive containing the .java source code files above.


Coursework 3

Free Form Coursework - Students should attempt the project of their choice. The nature of this project, the marking criteria and the number of marks it will attract are to be negotiated with Chris Wright before Week 7.


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 methods
HTML Activation File:
  hitter.html           - An HTML page that activates the two applets
You 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.

A WinZip archive containing the source code files above.


Go To: Eamonn's Place : Education