Java Reference
In-Depth Information
L
ISTING
6.7
OrderStatusApplet.html
<HTML>
<HEAD>
<TITLE>
Order Status Page
</TITLE>
</HEAD>
<BODY>
<APPLET
ARCHIVE = “swingall.jar”
CODE = “OrderStatusApplet.class”
NAME = “Order Status Applet”
WIDTH = 400
HEIGHT = 150
HSPACE = 0
VSPACE = 0
ALIGN = middle
>
</APPLET>
</BODY>
</HTML>
N
OTE
For this example, you must copy the HTML file and the compiled class files into your
Web server's document area. You will also need to have the
swingall.jar
file in this
same area. If you are using the Tomcat server, you can copy all of the client-side files
to the
SERVER_ROOT/djs/
directory. You should also note that this example has only
been tested using Microsoft's Internet Explorer v5.5.
After you have compiled and installed the HTML and class files, you can load the
OrderStatusApplet.html
file. Figure 6.1 shows the
OrderStatusApplet
after it is loaded.
The
OrderStatusServlet
The
OrderStatusServlet
services order-status requests sent by the
OrderStatusApplet
. It
reads the
Order
object from the
ObjectInputStream
and passes it to the
getOrderStatus()
method. In a “real-world” application, this method would be a client to some other real-time
server. It could be a CORBA client, an RMI client, or even a JDBC query to a database. For
the example, it simply calls the
Order.setStatus()
method, passing it the string
“Your order