Java Reference
In-Depth Information
http://www.webserver.com/appropriatepath/DisplayLabel.html
Web Server
Web Browser
The .html file and applet's .class files
are stored on the Web server.
HTML Page
F IGURE 18.3
A Web browser requests an HTML file from a Web server.
from an appropriate URL. For example, I have uploaded these two files on Web server
www.cs.armstrong.edu/ . As shown in Figure 18.2b, you can access the applet from
www.cs.armstrong.edu/liang/intro9e/book/DisplayLabel.html .
18.3.2 Viewing Applets Using the Applet Viewer Utility
You can test the applet using the applet viewer utility, which can be launched from the DOS
prompt using the appletviewer command, as shown in Figure 18.4a. Its output is shown in
Figure 18.4b.
appletviewer
(a)
(b)
F IGURE 18.4
The appletviewer command runs a Java applet in the applet viewer utility.
The applet viewer functions as a browser. It is convenient for testing applets during devel-
opment without launching a Web browser.
18.3
Describe the <applet> HTML tag. How do you embed an applet in a web page?
Check
18.4
How do you test an applet using the appletviewer command?
Point
18.4 Applet Security Restrictions
Applet security restrictions ensure that safety is maintained when running applets.
Key
Point
Java uses the so-called “sandbox security model” for executing applets to prevent destructive pro-
grams from damaging the system on which the browser is running. Applets are not allowed to use
resources outside the “sandbox.” Specifically, the sandbox restricts the following activities:
Applets are not allowed to read from, or write to, the file system of the computer.
Otherwise, they could damage the files and spread viruses.
Applets are not allowed to run programs on the browser's computer. Otherwise, they
might call destructive local programs and damage the local system on the user's
computer.
Applets are not allowed to establish connections between the user's computer and any
other computer, except for the server where the applets are stored. This restriction
prevents the applet from connecting the user's computer to another computer without
the user's knowledge.
 
 
Search WWH ::




Custom Search