New Combination of AJAX and J2EE to improve user experience (1)

Source: Internet
Author: User

In a traditional Web application model, a user triggers an action in a browser. The most typical case is to submit a form or click a hyperlink. The client browser sends an HTTP request to the Web server based on the current page status. After receiving the request, the server analyzes the request content, processes the data, and sends a response to the client. The browser refreshes the user interface based on the response content.

Since the birth of the HTTP protocol, our Web applications have been using this pattern (1 ).

Figure 1: Comparison between traditional network application models and AJAX Network Application Models

Therefore, every time a user performs an action, the user must go through the long waiting process of "request-processing-response-refresh", so that people can) the title is World Wide Wait.

On this issue, traditional solutions such as Applet have mitigated the response speed of Web applications in the client browser under the B/S architecture to a certain extent. However, Applet has well-known disadvantages: the loading speed is slow and unstable.

Google Gmail gives us a completely different experience. You cannot feel the page Jump, and the system responds very quickly.

You do not need to manually or automatically refresh the browser to obtain new emails. This makes people feel so friendly that it has been favored by many users since its launch and has become a target catch-up object for mail providers such as Sina and Yahoo.

In "Google Suggest (Google suggestion)", after the user inputs, the suggested actions are displayed almost instantly. Let's take a look at the "Google Maps" zoom-in function. The mouse action is almost immediately responded, so you don't have to wait for the page to refresh. Google Suggest and Google Maps are two typical examples of AJAX technology.

AJAX is short for Asynchronous JavaScript and XML, and is the latest integrated network client technology. It can implement rich clients under the B/S architecture, it can be used to build a new network application oriented to asynchronous messages, which fundamentally changes the pattern of our network applications.

J2EE is a standard defined by SUN for developing and running enterprise-level Web applications. It can be used to develop large-scale, multi-level, and distributed enterprise-level Web applications.

The J2EE technology provides a wide range of support for component development. It also provides a wide range of development tools and services to facilitate the development of modular, reusable, and cross-platform business logic.

The Web query module of the computer monitoring system is a brand new Web application that combines the charm of AJAX in the presentation layer with the powerful support of J2EE on the server side.

Conditions for AJAX implementation

The technologies used by AJAX are not completely new. These technologies have existed for a long time in the Internet Explorer browser of Windows platform. XMLHTTPRequest objects are not part of the official JavaScript specification, but AJAX is truly popular only when mainstream browsers support XMLHTTPRequest objects. At the same time, the formulation of XML and HTML Document Object Model specifications is also an important factor in the application of AJAX technology.

Technical core of AJAX

Core request object

In AJAX technology, objects are the core of interaction with the background. It is precisely because mainstream browsers support core request objects, so that we can use AJAX to build such a powerful network application in the B/S structure. However, it is not a standard technology stipulated by W3C. Therefore, different browsers use different methods to create core request objects. However, you can use a simple judgment statement to ensure that the object is correctly obtained when the browser supports it.

Parse response data

Before creating a user interface, you must first parse the required data from the XML format response. Currently, mainstream browsers support xml dom specifications, for example, Mozilla and Microsoft both implement this specification in their browsers, so we only need to use JavaScript standard DOM objects to parse XML format data returned from the server.

Dynamic rendering of interactive Web Interface

In AJAX, the content format of the server's response to the client only contains data in XML format, which makes the network exchange almost all valid data and greatly improves the transmission efficiency. However, data is not only displayed on the client.

In the original network application model, the task of generating interface elements that should have been undertaken by the server will be completed here by Java-Script using DHTML's Document Object Model. This includes not only the generation and layout of media elements in tables, forms, and various formats, but also the response to user operation events.

W3C sets the DHTML Document Object Model standard. We can easily get reference to elements on the HTML page, and then we can obtain data from the object, you can create, insert, or delete page elements to create a user interface.

Existing problems and defects

AJAX is a new network application that we can build, but currently it does have some problems and defects:

To support the new version of JavaScript, AJAX applications cannot work normally if the browser does not support or disables JavaScript scripts;

Most of the work is done by JavaScript, and the coding and debugging work is difficult;

Because JavaScript is used in AJAX as the script executed on the client, the source code is visible to the client, which may cause certain security issues;

Because operations on the page are called using JavaScript methods, there is almost no link on the page developed using AJAX. for modern crawler-style search engines, having no link is like losing the road map, unable to search for the network, so the pages currently using AJAX technology do not support the search engine.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.