Active web page chapter for reading purpose

168 views 16 slides Feb 15, 2024
Slide 1
Slide 1 of 16
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16

About This Presentation

Active Web Page


Slide Content

Active web Page Active web page come into exisitence due to the following questions were arises:- Why do the image takes times to download into client system Why can the Internet pages containing the multimedia such as sound or video and played it like TV.

The initial solution for this problem was client pull. In this technique is the browser running on client side repeatedly request the web server for web pages containing the images and on receiving them, displays them one after the other at the rate of 30 pfs to create the animation. This process is slow. The problem with this scheme is that, it seems fine in theory, but there is practical problem for implementing it. Suppose that we are running high power computer and using the high speed Internet can't received these images as fast as we want. These images received by the client is in distorted and delayed which defeat the purpose of client pull. The problem associated with client pull was overcome by new technique called active web page.

An active web page actually contains the computer program for drawing the images at client side. This program executed in client web browser. This works as follows:- It is similar to static and dynamic web pages, active web pages are stored on web server. With each active web page a URL is associated. Retrieval of an active web page is similar to static web page and dynamic web page. When a browser specify the URL of specific web page, server search it in database and locate the active web page and send it to client. In active web page the browser actually runs a computer program embedded in active web page. This program draw an image on the users computer. Thus, active web page execute on client side rather than at server side. That is why active web page is faster to access and downloaded on client system.

Why are Active Web Pages Powerful Active web pages get downloaded into client computer. There they locally perform computation and tasks such as displaying images and create animations. Therefore, their is no delay between creating an image and displaying it. Once the active web page is downloaded on to client system then their is no need to contact the server again unlike in client pull. As a result a client computer will have full control on displaying an animation, slow internet connection doesn't matter. Since the client computer takes the responsibilities to execute the program web server is relieved to do that. This will reduce the burden on web server. Unlike in dynamic web page, program is executed at server side and when many users accessing the server leads to delay in processing the information by the web server. But in case of active web pages it is responsibilties of client computer.  

When not to use the active web page Active web pages are mainly used for client side animation. However they are not useful when server side programming is required. Server side programming is required for business logic and validation of the database. For instance user entered user id and password, active web page can't be used because these information/details are to be validated against user id's and password are stored at server side database. Active web page are used for mainly client side execution of code for example applets.

Java Applets An applet is a small program which is written in the Java programming language and is embedded in HTML page to form a web page. An applet makes a web page active. An applets get downloaded to web browser along with the requested web page and is executed there under the control of the Java Virtual Machine (JVM) installed in the web browser. An applets then create animation on the client computer.

Life Cycle of Java Applet Java applet is event driven similar to operating system has Interrupt Service Routine (ISR). An applets wait until specific event happens. When such an events occurs, the applet receive information from the java virtual machine(JVM) inside the browser. The applet is then has to take an appropriate action and upon completion give back control to JVM. For example when user moves the mouse inside an applet window, applet is informed that there is mouse driven event. Typical life cycle of the java applet is:-

When an applet is executed for the first time, the init(), start() and paint() methods are called in the said sequence: init() : it is used for initialize variable or for doing any other start up processing. It is called during the life time of an applet. Start() : this method is called after init(). It is also called to restart an applet after it is stopped. Whereas init() is called only one once, start() method is called every time the web page open the containing the applet displayed on the screen. Therefore, if user leaves a web page open and come back to it, the applet resume execution at start(). Paint() : this method is called each time the applet output must be redrawn. For instance window of other application can overwrite the window in which applet is running or the user minimze and then restore the applet window.

Stop() : this methos is called when user leave the web pages containing the applet. This can happen when user select or type the url of other web page. The stop() method is used to suspend all the threads that are running for an applet. Destroy() : this method is used when environment determines that applet needs to be removed completely from the client directory. This method is then free all the resources are used by the applet.

Simple applet example <html> <body> <applet code=” TestApplet ” width=”200” height=”250”</applet> </body> </html>

Java Beans Reusability comes at the core of any modern computer language's framework. It is often desirable to use components you previously built in recurring environments. In Rapid Application Development, these prove more helpful as you can drag them off a list of components and use it elsewhere in your project. Such level of reusability is added into the Java Programming language with the help of the JavaBeans architecture. JavaBeans are the mainstream Java component model, introduced in 1996 by Sun Microsystems. JavaBeans are defined as follows:

"A JavaBean is a reusable software component that can be manipulated visually in a builder tool." A software component is a reusable object that can be plugged into any target software application. You can develop software components using various programming languages, such as C, C++, Java, and Visual Basic. A “Bean” is a reusable software component model based on sun’s java bean specification that can be manipulated visually in a builder tool. The term software component model describe how to create and use reusable software components to build an application.

Builder tool is nothing but an application development tool which lets you both to create new beans or use existing beans to create an application. To enrich the software systems by adopting component technology JAVA came up with the concept called Java Beans. Java provides the facility of creating some user defined components by means of Bean programming. We create simple components using java beans. We can directly embed these beans into the software.

Advantages of Java Beans: The java beans posses the property of “Write once and run anywhere”. Beans can work in different local platforms. Beans have the capability of capturing the events sent by other objects and vice versa enabling object communication. The properties, events and methods of the bean can be controlled by the application developer.(ex. Add new properties). Beans can be configured with the help of auxiliary software during design time.(no hassle at runtime). The configuration setting can be made persistent.(reused). Configuration setting of a bean can be saved in persistent storage and restored later.

What can we do/create by using JavaBean : There is no restriction on the capability of a Bean. It may perform a simple function, such as checking the spelling of a document, or a complex function, such as forecasting the performance of a stock portfolio. A Bean may be visible to an end user. One example of this is a button on a graphical user interface. Software to generate a pie chart from a set of data points is an example of a Bean that can execute locally. Bean that provides real-time price information from a stock or commodities exchange.
Tags