The way to use a traditional web application by entering data, clicking a button, and then waiting for something to happen is well known to all of us. Today, users of web sites no longer accept this kind of interruption in their workflow. They expect a web application to work with them, to respond immediately to any action they take.
Web application developers have been trying to quickly adapt to meet this new demand for more interactive and dynamic web applications, and many of them are using
Ajax to achieve this goal. The Ajax technique uses
JavaScript technology to respond to a user's action on a widget. It uses an
XMLHttpRequest object to asynchronously exchange
XML data between the client and the server and to update part of the HTML
Document Object Model (DOM) that represents the page with the XML data.
The application must be able to handle conversion, validation, data persistence, and navigation. Just throwing some Ajax technology into a web application is not enough. You must be sure that you are doing it right and following recommended design patterns.
With Ajax, you can decide which tools and technologies to use to properly develop Ajax-enabled applications. All you need to run an Ajax application is a browser that supports JavaScript technology, as most browsers in use today do. To develop your Ajax-enabled web application, you can use the Java Platform, Enterprise Edition (Java EE), some other development platform, or one of the many scripting languages.
Using Java EE platform tools and technologies to build Ajax-enabled applications gives your application access to the entire Java EE platform stack, including new and updated web services and database access technologies. In the stack's web tier, you get Servlets, JavaServer Pages (JSP) technology, and Java Standard Tag Library (JSTL). You also get
JavaServer Faces technology 1.2, a framework for building rich user interfaces for web applications. It offers a sophisticated, extensible component model for handling events, converting and validating data, and managing component state.
JavaServer Faces technology also makes it easy for you to add Ajax to your application. Instead of embedding the JavaScript technology directly in the page, you can encapsulate it inside of a JavaServer Faces component and use all the benefits that this model gives you.
If you are using JSP technology without JavaServer Faces technology, you can also encapsulate Ajax functionality using custom tags. Coupled with the rest of the Java EE platform stack, the JSP and JavaServer Faces technologies give you everything you need to complete the server-side picture of your Ajax-enabled web application.
In spite of all the benefits of using the Java programming language, in which all Java EE platform components are written, a growing number of developers prefer scripting languages because they allow for more rapid development. When developers want to add Ajax functionality to their web applications, they cannot ignore the value of the rapid development that scripting languages offer.
One of the features of scripting languages that foster rapid development is dynamic typing. Because of the dynamically typed nature of scripting languages, developers find that these languages are better for building rapidly evolving systems, connecting different components, and extending existing software components. In part because of this dynamic typing, developers discover that they can often write fewer lines of code when programming with dynamic languages.
Another characteristic of scripting languages is that they do not require a separate compilation step. This allows developers to deploy an application without compiling it and further allows them to manipulate the code while it is running without having to redeploy it.
Although the characteristics of dynamic languages can provide advantages in some situations, they may come at a high cost in others. Because of dynamic typing, a developer trying to read another developer's scripting code might find it an impossible task. In most cases, you would have to execute the code to see what it does and understand it.
Another problem is that developers can experience reduced execution speed as a result of the additional runtime checks they need to perform because there is no compilation step. More importantly, when building more robust applications, developers prefer to catch as many errors as possible during compile time rather than at runtime. This is where a statically typed system language such as the Java programming language comes in. You can use it for those parts of the application that change less frequently, such as graphical user interface components, and for methods that perform complex calculations or manipulate large amounts of data. You can use scripting to connect these parts of an application.