Ajax and JSF is the most popular of today's Internet technology, Ajax is called the cornerstone of Web 2.0. Unfortunately, not easy to create Ajax applications, especially when you need to integrate with other frameworks, such as JavaServer? Framework (JSF). Fortunately, IBM Rational Application Developer V7 provides Ajax components for the JSF capabilities, this feature makes this task easier. This article describes how IBM Rational Application Developer V7 to use Ajax and JSF to reduce the difficulty of the task, and demonstrate through an example of how existing applications to increase Ajax support.
Ajax's strengths and weaknesses
Although not a revolutionary innovation, Ajax technology has become very popular in the last two years. A large number of major Web sites (such as Google, Yahoo!, Amazon and Netflix) to use this technology to improve access to their site users experience. Actually, Ajax to improve the user experience is to do.
In the past ten years Web application development, between the user and the browser and the browser and server interaction between a clearly defined and obvious: the user browse the web browser, perform the operation (from the context menu, select the content, or select some check boxes), followed by clicking on the link or submit button to guide the browser and server. Browser sends a request to the server and pass user input. Server processes the request and return a response, the returned page may be updated, or the same page, a word has been updated.
This Web application is now referred to as Web 1.0. From the user experience point of view, they have two shortcomings:
◆ browser and server interaction is limited only by the page, launch control - often links and buttons. This can not be selected in the user box (check box) or in the combo box (combo box) quickly inform the server.
◆ browser and the server the consequences of this interaction is the need to update the entire browser window. This usually is slow, the page updates often require users to wait a long time. Worse, when the same page is reloaded or re-refresh, often flash in the browser window.
Referred to as Web 2.0, a new generation of Web applications through the use of Ajax technology to make up for these shortcomings (and as AJAX, or Asynchronous JavaScript and XML, Asynchronous JavaScript and XML). In Ajax, the browser and server interaction occurs in the background, the user will not be aware of. And it more than normal "browser - server" interaction is more focused, only a subset of pages need to be sent to the server and the server returns only a subset of pages needed updating. In this way the consequences is that the browser and server communications between any of the events can be initialized, such as in the combo box or check box to choose, or the mouse pointer over events. This has brought great benefits:
◆ communication more rapid, because less data transfer.
◆ user stays on the same page, because they no longer need to navigate between pages too.
◆ reload the page will not flicker, because only a small part of the page based on Ajax request updates.
The idea behind Ajax is simple: listening to events in the browser to the server sends back a request, when the server response to update part of a page. But the realization is very complicated. It requires JavaScript?, Client - server communication protocol, and the deep knowledge of server-side code. Different browser versions makes the distinction between development and debugging more difficult. However, IBM? Rational? Application Developer Version 7 offers all the Ajax Web application development tools needed, without having to achieve all the underlying details.
Rational Application Developer V7 provides:
◆ extended JSF allows JavaServer? Framework (JSF) Ajax request to address
◆ 1 in all the latest versions of major browsers initialize Ajax request and the server side to respond to only part of the page to update the JavaScript? Library
Rational Application Developer V7 Ajax and JSF implementation in the technical details are beyond the scope of this article, but let's look at how you can use these technologies.
How Ajax JSF Component Application
Ajax JSF page for the increased needs of four steps:
1. Identify the updated page from the Ajax request area. In Rational Application Developer V7, you can almost any panel in the content of components used in Ajax. Panels ranging from simple containers, for example, and, to a feature-rich panel, such as menu () and dialog ().
2. Select the type used in the Ajax request. Rational Application Developer V7 JSF library supports three Ajax request:
◆ GET request for the same page ()
◆ POST request for the same page ()
GET other pages ◆ on request ()
3. Applications Ajax request to the server configuration parameters.
◆ For GET requests, the page you can pass the value of the different input fields.
◆ For POST request, submit all forms.
4. Identification Ajax request initialization events. It can be any client-side JavaScript events, such as the button's onclick, enter the column onblur, or check box in the onchange.