Java Reference
In-Depth Information
A GUI application uses graphical components to facili-
tate the input and output of the program. An example
GUI for calculating BMI is shown in Figure 2-7.
Java applets
An applet is a Java application that's typically embed-
ded in an HTML page and run by the client web
browser. Applets run in a sandbox , which is a con-
fined space in memory that guarantees their execution
is secure. Applets can make use of the full expres-
sive power of the Java language. They are defined in
HTML by means of the <applet> tag, as follows:
figure 2-7  
<Applet>
</Applet)
They were typically used for graphics and rich interfaces but are not that popular anymore due to
some recent security exploits. Their functionality has been replaced more and more by JavaScript
and HTML 5. In fact, applets are no longer supported by many tablets or other mobile devices.
Java Servlets
Servlets are part of the J2EE platform and are small Java applications that run on a Java-enabled
Application server. Servlets can read and process data (originated from, for example, an HTML form)
sent by the client browser through HTTP. They can interact with a server database, invoke web services,
or call other servlets or server-side functionality. The results can then be communicated back to the client
browser in a variety of formats (such as in HTML, XML, Word, and so on). Servlets are used in an envi-
ronment where they may process multiple requests simultaneously. This is visualized in Figure 2-8.
Client
Databases
Web server
Client
Servlet
Client
figure 2-8  
 
Search WWH ::




Custom Search