AJAX Asynchronous Java Script And XML By Srinivasa
AJAX (Asynchronous Java. Script And XML) By Srinivasa Aditya Uppu Fall-2008 CIS 764
Facts ØAJAX is a type of programming made popular in 2005 by Google (with Google Suggest). ØAJAX is not a new programming language, but a new way to use existing technologies. Ø With AJAX you can create better, faster, and more user-friendly web applications.
AJAX is based on the following web technologies: ØJava Script ØXML ØHTML ØCSS
Building an AJAX Application <html> <body> <form name="my. Form"> Name: <input type="text" name="username" /> Time: <input type="text" name="time" /> </form> </body> </html>
Building an AJAX Application (Contd. . ) <script type="text/ javascript"> function ajax. Function() { var xml. Http; try { // Firefox, Opera 8. 0+, Safari xml. Http=new XMLHttp. Request(); } catch (e) { // Internet Explorer try { xml. Http=new Active. XObject("Msxml 2. XMLHTTP"); } catch (e) { try { xml. Http=new Active. XObject("Microsoft. XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } </script>
Building an AJAX Application (Contd. . ) ØThe ready. State Property State Description 0 Request not initialised 1 Request has been set up 2 Request has been sent 3 Request is in process 4 Request is complete xml. Http. onreadystatechange=function() { if( xml. Http. ready. State==4 ) { document. my. Form. time. value= xml. Http. response. Text; } }
Building an AJAX Application (Contd. . ) Sending a Request to the Server xml. Http. open("GET", "time. asp", true); xml. Http. send(null); Executing the AJAX function <form name="my. Form"> Name: <input type="text" onkeyup="ajax. Function(); " name="username" /> Time: <input type="text" name="time" /> </form>
Examples Øhttp: //maps. google. com/ Øhttp: //www. flickr. com/ Øhttp: //www. google. com/ig Øhttp: //www. kayak. com/ Øhttp: //www. orkut. com/Main#Home. aspx
AJAX Frameworks ØAjax frameworks support Ajax technologies to build dynamic, client-side web sites. ØThe goal of the Ajax framework is to function as a communication layer between user and server. ØAllow you to develop AJAX application much like a desktop GUI, by composing reusable widgets and attaching behavior and data to them.
Types of AJAX Frameworks ØDirect object frameworks - Smaller – Website Development ØAjax component frameworks - Larger – Web Applications ØServer driven Ajax frameworks - Server Side Developers
AJAX Component Framework ØUse pre-made components to generate and apply HTML. ØMore rapid development and require less control. ØComponent frameworks provide customized APIs, allow dynamic program control based on user input, and create new components based on existing ones.
AJAX enabled JSF Components and Framework ØBackbase Enterprise Ajax is the leading Ajax framework.
Backbase Ajax Development Tools ØVisual Ajax Builder ØDebugger (client-side) ØCode Samples and Starter Kits ØExtensive Documentation
Visual Ajax Builder ØCode named Telamon. ØIt is the only WYSIWYG Integrated Development Environment (IDE) specifically designed for Rapid Application Development of Ajax based applications. ØIt uniquely allows you to make changes to your code while browsing through the pages.
Code Samples and Starter Kits ØThe hundreds of code samples in the Backbase Ajax Explorer can be used to learn the technology and quickly assemble feature-rich Ajax applications. Øhttp: //demo. backbase. com/explorer/#|examples/we lcome. xml
Advantages of AJAX ØAjax’s primary contribution to web pages is userexperience improvement. ØDecreases User Delay ØDecrease in Bandwidth ØComplex User Interface Controls and effects
Disadvantages ØDynamically created pages do not register themselves with the browser's history engine. ØAny user whose browser does not support Ajax or Java. Script, or simply has Java. Script disabled, will not be able to use its functionality. ØLacks Security ØEven though Ajax should typically speed up your web page, it ultimately is dependent upon the same hardware as other web technologies and thus is subject to the same problems as normal web pages.
References ØAjax: A New Approach to Web Applications By Jesse James Garrett, February 18, 2005 http: //www. adaptivepath. com/ideas/essays/archives/000385. php ØAsynchronous Java. Script Technology and XML (Ajax) With the Java Platform By Greg Murray, June 9, 2005, updated October 2006 http: //java. sun. com/developer/technical. Articles/J 2 EE/AJAX/ ØBeginning AJAX By Chris Ullman, Lucinda Dykes, March 2007 http: //www. wrox. com/Wiley. CDA/Section/What-is-Ajax-. id-303217. html ØBuilding AJAX Applications http: //www. w 3 schools. com/Ajax/Default. Asp ØAjax Frameworks http: //www. ajaxwith. com/Ajax-Frameworks. html ØBackbase AJAX Framework http: //www. backbase. com/
Questions?
- Slides: 21