Introduction to the AJAX framework

Source: Internet
Author: User
Tags documentation xslt ruby on rails

Introduction to the AJAX framework
So far, you've probably noticed that there's a lot of trouble with Ajax programming. If you want to support multiple browsers (now who still support only one browser?) Will undoubtedly encounter incompatibility issues. Look at a simple action, such as creating an instance of a XMLHttpRequest object, which requires a browser test first. Once you start experimenting with Ajax techniques, you'll soon notice that you have to do the same tasks over and over again. Of course, you can collect some common code libraries, or even create your own framework. Before you do this, though, you need to know what's already going on.
Like all good Technology, Ajax has spawned a lot of frameworks, and the developer's life is much better with these frameworks. We would like to emphasize that Ajax is still new and evolving, as is the framework area. There are new arrivals almost every day, and no one can see who is the winner at the moment. Before June 2003, there was not much of a framework, so there could be significant changes in the next few months.
Some frameworks are based on clients, some are server-based, some are specifically designed for specific languages, and others are language independent. Most of them have open source implementations, but few are dedicated. We do not talk about each framework in any detail, and it is not possible to delve into each of the frameworks mentioned. Our starting point is very clear, is to let you have some knowledge of what is now. As you read this appendix, some of the toolkits we mentioned may have disappeared, while others may have just been created. Which frame is best for you. Only you have a say in this question, but you can be conservative before you stabilize the framework. There are even people who are putting together the various frameworks that should be done at the end of the work. When you read this book, the situation should be more clear, but perhaps you would like to know the current situation.
B.1 Browser-side framework
The following sections describe some of the browser-side frameworks.
b.1.1 Dojo
Dojo is one of the oldest frameworks to start developing in September 2004. The goal of this project is to build on the full use of XHR DHTML Toolkit and focus on usability issues. Dojo has only a few files, no need to deal with XHR, just call the bind method and pass in the URL and callback method that you want to call. It's as simple as that. You can also use the Bind method to submit an entire form.
Dojo has a feature that makes it unique, which is that it supports the back and forward buttons. Although this feature is not necessarily available on every browser (unfortunately, Safari is an anomaly), you can actually register a callback method that triggers when the user clicks the Back button or forward button. Dojo also provides a changeurl tag that tries to solve the bookmarks inherent in using AJAX.
Dojo appears to be one of the more sophisticated toolkits, and it's good to focus on usability. Dojo is fairly stable and has some support behind it. Dojo's mailing lists are quite active, and it may be more helpful to look at more documents. More information can be obtained in dojotoolkit.org.
b.1.2 Rico
Rico is one of the newest frameworks on the market, developed by Sabre Airline Solutions, and then becomes open source implementation. Of course, Rico is rich in Spanish, stating that the overall goal of the project is to provide a set of components to develop rich Internet applications. It is supported by a wide range of browsers, but it is puzzling that safari does not support Rico.
Unlike dojo, which focuses on usability, Rico is designed for drag-and-drop actions, data grids, and so-called movie effects (moving parts, fading, and so on). The RICO website has many interesting demo versions (demos) and provides code. This is a good starting point if developers want to get to know Rico as quickly as possible and run it. There are not many related documents, but this will change as the framework matures.
Rico can be downloaded as a single file, but you may also need to prototype JS library. For more information please visit openrico.org/home.page.
b.1.3 Qooxdoo
Qooxdoo is also a new member of the AJAX framework domain, providing a JavaScript-based toolkit to make up for the lack of HTML. Although still in the early alpha phase, Qooxdoo does provide some pretty compelling parts. Using Qooxdoo, you can simulate some of the features in a standard FAT customer application, such as a menu bar, tooltips, grid layouts, and drag-and-drop support.
Qooxdoo does have some useful documentation and provides a helpful explanation for the underlying details. The charm of Qooxdoo is clearly reflected in its complex parts. If your goal is to create a thin application and expect it to be similar to a FAT client, try Qooxdoo. For more information please visit qooxdoo.oss.schlund.de.
b.1.4 TIBET
When do you think Ajax first came into being? According to this explanation, Tibet may be thought to be the oldest existing framework. As documented, the Tibet team has been developing this toolkit since 1997, with the goal of providing enterprise-class AJAX support. Tibet does not appear to be just wrapping the XMLHttpRequest object, it also provides support for Web services and underlying protocols, and provides a preset wrapper for Google, Amazon, and many other common services.
The real Tibet is that it has a fully interactive browser-based IDE, which greatly simplifies development, debugging, and unit testing. For more information please visit www.technicalpursuit.com.
b.1.5 Flash/javascript Integration Package
Before Ajax, Flash was very popular, and many Web sites were built on the flash platform. Those who have worked flash do not want to give up the flash altogether, and use the Open-source project to leverage Ajax technology at the same time. This toolkit is available on all major browsers, allowing JavaScript to invoke Actionscript,actionscript and invoke JavaScript. A large number of objects can be passed back and forth, including dates, strings, and arrays.
The installation of the Flash/javascript integration package involves some JavaScript files, as well as two library functions for Flash. It takes a few lines of code to invoke the ActionScript function from the page. There are quite a few documents involved, but if you want to use Ajax to access Flash, the toolkit is worth studying. For more information please visit Weblogs.macromedia.
com/flashjavascript/.
b.1.6 Google ajaxslt
Based on Google Maps's work, Google Ajaxslt is a JavaScript implementation using XPath XSL Transformations (XSLT). XSLT can convert XML documents into other languages, such as HTML. AJAXSLT allows JavaScript to be used directly on browsers to complete these transformations.
Google AJAXSLT works on all major browsers, and it is published under the BSD license. The toolkit is small, includes several JavaScript files, and some handy test pages. Google Ajaxslt is not perfect, but if Google suggest is prompted, we hope Google Ajaxslt's shortcomings can be resolved quickly. Because Google is one of the first sites to use Ajax, it's interesting to see that it will increase in the next few months. For more information please visit goog-ajaxslt.sourceforge.net.
b.1.7 libxmlrequest
The Libxmlrequest framework is also a relatively old framework, which was released as early as 2003. This framework includes a JavaScript file that is equivalent to a wrapper for the XMLHttpRequest object and provides two overloaded request functions: Getxml and Postxml. In addition, it has properties that handle buffer pools and caches, and some tool functions handle common tasks such as parsing XML from the server and modifying the DOM.
It is not clear which browsers the toolkit can run on, and the documentation is relatively small. This toolkit is copyrighted to all of its author, Stephen W. Cote, which does not mention licensing issues. So you can only use it to help you generate inspiration. For more information please visit www.whitefrost.com/index.jsp.
b.1.8 Rslite
Rslite is an implementation of a remote script, written by Brent Ashley. Technically, it does not take advantage of the XMLHttpRequest object as the core of Ajax, but it is supported by a wider range of browsers. If you need to support the original browser, and these browsers do not support XMLHttpRequest objects, you can try Rslite. Rslite is quite lightweight and has been developed since 2000. For more information, please visit www.ashleyit.com/rs/rslite/.
b.1.9 SACK
SACK (Simple AJAX Code Pack) developed into a thin wrapper, wrapping the XMLHttpRequest object. Many of the other frameworks are too complex and have done many tasks that they should not have done, Gregory Wild-smith, its author. So he created the sack to simplify the development of Ajax. Sack includes several ways to simplify server invocation. Rather than creating the appropriate XMLHttpRequest object instance, you can send data to the server with less code and handle the response.
The sack consists of a JavaScript file that contains little code. Sack the release of the underlying software was modified X11 license (also known as the MIT License) and, like most open source projects, its documentation was not much, but the entry was certainly more than sufficient. The real strength of sack is its simplicity, and if you're looking for a basic wrapper, try sack. For more information please visit twilightuniverse.com/projects/sack/.
b.1.10 Sarrisa
Sarissa One thing Ajax can't do, it provides wrapper support for XML APIs in a browser-independent way. Using this framework, creating and using XMLHttpRequest objects is a piece of cake (don't check your browser, it's already done for you). In addition, Sarissa provides support for using DOM. Similar to Google Ajaxslt,sarissa also supports XSLT, which simulates the Mozilla processor on IE.
The Sarissa includes only a few classes and is released under the GPL protocol. Mozilla/firefox and IE both fully support sarissa, and some functions are not available in opera, Konqueror, and Safari browsers. For more information please visit Sarissa.
sourceforge.net/doc/.
b.1.11 Xhconn
Xhconn is similar to sack, which is equivalent to a simple wrapper for a XMLHttpRequest object. Instead of using the XMLHttpRequest object directly, you need to first start a xhconn instance and process it in the same way that you use XHR. That is, there is no need for browser checking and provides an easy way to determine whether the browser supports XHR (this is especially convenient for sites that need to be degraded properly).
Xhconn can work in Safari, IE, Mozilla, Firefox and Opera. Similar to most AJAX frameworks, this is an open source implementation, published under the Creative Commons license protocol. Xhconn is a file with little code, but it does do what it does-simplifying Ajax. For more information please visit xkr.us/
code/javascript/xhconn/.
B.2 Server-side framework
The following describes the server-side framework.
b.2.1 Cpaint
The Cpaint (Cross-platform Asynchronous Interface Toolkit) implements AJAX on the server side, which returns text or DOM document objects to the customer for use with JavaScript. Cpaint is available on most major browsers and supports remote scripting, which is released under the GPL protocol. The documentation for this project is quite complete, but cpaint only supports PHP and ASP. For more information please visit sourceforge.net/projects/cpaint/.
b.2.2 Sajax
With Sajax, you can invoke server-side code directly from JavaScript. Sajax supports languages such as Perl, Python, Ruby, and ASP (but strangely, Java is not currently supported). Installing Sajax is fairly straightforward and involves only a simple library for a specific server language. Sajax's development community is extremely active. Only IE 6 and mozilla/firefox have been identified to provide sajax support, but the author of this book thinks it can be used well in safari. For more information please visit Www.modernmethod.com/sajax.
b.2.3 Json/json-rpc
JavaScript Object Annotations (JSON) is a text format that is similar to XML and can be used to exchange data. JSON design to ensure that two aspects, on the one hand easy to read, on the other hand easy machine parsing, it uses the C-series language similar to the Convention. Also associated with JSON is JSON-RPC, a remote procedure call (RPC) protocol that resembles XML-RPC, but is oriented to the JSON language. As a statute, JSON-RPC is implemented in many languages, including Java, Ruby, Python, and Perl.
Since JSON-RPC is the statute, you need to know which particular implementation is appropriate for your environment and to fully understand the specific implementation. Depending on the implementation, some of the implemented documents are fairly complete and some are not. There is also a significant difference in the level of participation of developers. There has been little discussion about the JSON-RPC statute. For more information please visit www.crockford.com/JSON/index.html.
b.2.4 Direct Web Remoting
With direct Web Remoting (DWR), you can invoke Java methods directly from JavaScript as if they were native to browsers. Although the background is strictly limited to Java, DWR is still one of the most popular frameworks. DWR's documentation is the best, and there are some useful examples to help you get started.
Installation is not difficult, but you also need to edit the deployment profile for the Web application and edit the DWR specific files. The DWR configuration file specifies a class that can be created and invoked remotely, and the document warns the user that there are some security issues with invoking the server from the browser. In addition to the jar files that contain the server-side code, there are also two JavaScript files that contain some auxiliary functions. DWR is suitable for some common web frameworks, such as struts and tapestry, which are published under the Apache protocol. DWR can help you if you want to invoke Java methods from a Web page. For more information please visit getahead.ltd.uk/dwr/index.
b.2.5 Swato
Shift Web applications to (Swato) is also a Java-based AJAX framework solution. Swato works in all servlet 2.3 or later containers, similar to DWR, and it also needs to make some updates to the configuration file. Interestingly, Swato fully leverages JSON to marshal data between customers and servers, similar to some of the other frameworks discussed in this appendix, and it also allows server-side Java to be invoked from the browser. To help developers, Swato includes a number of reusable components, such as auto-complete text boxes.
Using Swato is relatively complex compared to using other frameworks, and the classes to be accessed need to implement a Swato interface. However, its documentation is fairly complete and more than sufficient for getting started. Swato is designed to use spring to package services, but not necessarily. For more information please visit https://swato.dev.java.net/doc/html/.
b.2.6 Java Blueprints
Sun's blueprints team has been busy integrating Ajax into their solution catalogs (Solutions Catalog). Solutions catalog includes good documentation that describes how to use basic Ajax, how to automate, how to create a progress bar, and how to validate a form. It also includes JavaServer faces components. Code developed for Blueprints Solutions catalog can be obtained from the Www.java.net Web site.
b.2.7 ajax.net
Ajax.NET to Microsoft. NET is the equivalent of Sajax, DWR and Swato to Java. With Ajax.NET, you can invoke the. Net method from a JavaScript client. Ajax.NET includes a DLL that can be used with VB. NET or C # in conjunction with. Ajax.NET's documentation is a good way to showcase solutions for a variety of scenarios and to get the relevant source code. However, Ajax.NET's license agreement is not clear. For more information please visit ajax.net.
b.2.8 Microsoft's Atlas project
Microsoft has been involved in the field of Ajax for a short time, after all, the XMLHttpRequest object was invented by Microsoft and has been used in the Web version of Outlook since 1998. Microsoft has focused on providing a more robust development environment, making it easier for developers to work. Microsoft's focus is not just these, it's also trying to provide a client-script framework, ASP. NET control and Web services integration. Microsoft also released the Atlas project as part of its ASP.net 2.0 preview. With Microsoft's intervention, developers ' toolkits may be much richer than they are today. For more information please visit beta.asp.net/default.aspx?tabindex=7&t-
Abid=47.
b.2.9 Ruby on Rails
Rails is an exciting new web framework based on the Ruby language. Today, rails has received a lot of attention (check rails on Google for more information) because of the rapid development of web-based applications with rails. When developing the Basecamp, the 37signals team presented a framework called rails. Basecamp is just the main example of AJAX applications, so we should not be surprised to see that rails provides such full support for Ajax. Rails has a number of built-in JavaScript libraries, which wrap a lot of common features and include a module that wraps Ruby's JavaScript calls. If you're using rails, you'll find Ajax very simple. For more information please visit www.rubyonrails.org.

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.