Applet is a special type of Java program that is used in web applications. Applets are embedded within a HyperText Markup Language (HTML) document. Applets provide a way to give life to a web page. Applets can be used to handle client-side validations. Browsers are required for their execution. Applets allow event-driven programming.
Working of Java Applet
Java applets like Java programs consist of one or more class definitions. Once compiled, these classes are stored as files with a .class extension and they consist of Java bytecode. Java bytecode is created by a Java-compatible compiler. Unlike Java applications, applets are executed within a Java-enabled web browser such as Internet Explorer or tools like appletviewer. Applets are embedded within an HTML document via the APPLET tag that references the Java applet's compiled .class file.
Types of Applets: Web pages can contain two types of applets which are named after the location at which they are stored.
1. Local Applet
2. Remote Applet
Local Applets: A local applet is the one that is stored on our own computer system. When the Web-page has to find a local applet, it doesn't need to retrieve information from the Internet. A local applet is specified by a path name and a file name as shown below in which the codebase attribute specifies a path name, whereas the code attribute specifies the name of the byte-code file that contains the applet's code.
Remote Applets: A remote applet is the one that is located on a remote computer system . This computer system may be located in the building next door or it may be on the other side of the world. No matter where the remote applet is located, it's downloaded onto our computer via the Internet. The browser must be connected to the Internet at the time it needs to display the remote applet. To reference a remote applet in Web page, we must know the applet's URL (where it's located on the Web) and any attributes and parameters that we need to supply. A local applet is specified by a url and a file name as shown below.
0 comments:
Post a Comment