Académique Documents
Professionnel Documents
Culture Documents
Applications today
You have two basic choices: Desktop applications and Web applications
Desktop
Desktop applications
applications
It usually come on a CD and install completely on your computer.
The code that runs these applications resides on your desktop.
It is usually pretty fast, has great user interfaces and is incredibly dynamic.
Web
Web applications
applications
It runs on a Web server and you access the application with your Web browser
It provides services you could never get on your desktop
(think about Amazon.com and eBay).
waiting for a server to respond, waiting for a screen to refresh,
waiting for a request to come back and generate a new page.
Ajax
Ajax attempts
attempts to
to bridge
bridge the
the gap
gap between
between the
the functionality
functionality and
and interactivity
interactivity
What is AJAX ?
Increase
Increase the
the Web
Web page's
page's interactivity,
interactivity, speed,
speed, and
and usability;
usability; better
better user
user experience
experience
Ajax
a big step toward the Holy Grail
of having the kinds of speed and
responsiveness in Web-based
programs that's usually associated
only with desktop software
Wow..I didnt
know soccer
teams did web
programming..
Technologies
DOM
DOM accessed
accessed with
with aa client-side
client-side scripting
scripting language
language
Dynamically display and interact with the information presented
XMLHttpRequest
XMLHttpRequest object
object
Exchange data asynchronously with the web server
XML
XML
Format for transferring data
Pick An Item
Add To Cart
Action
Validation
Persistence
Forwarding
Review Cart
Enter Data
Submit
Action
Validation
Persistence
Forwarding
Enter
Shipping
Enter Data
Submit
Action
Validation
Persistence
Forwarding
Enter Billing
Enter Data
Submit
AJAX-Model
Order Entry
Item List (DIV)
Events/Actions
ErrorViewer
(DIV)
AJAX
Validation
Persistence
Shopping Cart
Component
Event Handlers
GUI Creation
Shipping
Component
Billing
Component
<script type=text/javascript>
Message
name=bhanwar
Or
<name>Bhanwar</name>
XMLHttpRequest
function handleResponse() {
read response from server
get a handle to the DIV
If Not OK
Replace DIV contents with msg
}
function checkName( name ) {
initialize request (url, parms)
register callback function
call the server
}
Validation Servlet
ValidateName( req, res) {
parse request
lookup name in database
is it valid?
if so, return OK
otherwise
return error message
Message
status=999
msg=Not a valid name
Database
Save
<div
id=status
Not
a Valid
Name >
Client/Browser
Server
Ajax Alternatives
XUL
Desktop-like UI
Platform
Independence
Vendor
Independence
Skill Set
Transferrance
XAML
SVG
Flash
Applets
Ajax
The Technologies
DHTML HTML + JavaScript
+ CSS
AJAX DHTML + XML
Flash
Browser Extensions/Plug-ins
Java
ActiveX
Others not to be discussed
XUL, CURL, etc.
Backend Frameworks
browser
UI
browser
UI
request
HTML
HTML/ /CSS
CSS
data
data
other
other
data
data (e.g.
(e.g.
images)
images)
data
how it all works -1. User clicks on a link: rendering engine / browser sends of a request
for
1
2
a document.
3
browser
1
UI
request
4
HTML
HTML/ /CSS
CSS
data
data
5
other
other
data
data (e.g.
(e.g.
images)
images)
3
data
browser
UI
JavaScript
programs can
detect UI events
(clicks, etc.) and
run code when
the user does
something:
interactivity is
programmable.
JavaScript Engine
HTML
HTML/ /CSS
CSS
data
data
JavaScript
JavaScript
programs
programs
data
other
other
data
data (e.g.
(e.g.
images)
images)
JavaScript programs, via the engine, can access and modify the HTML /
CSS data, dynamically changing the UI thats displayed.
browser
UI
XMLHttpRequest()
HTML rendering engine
JavaScript
programs can
now go off
and do their
own thing,
including
getting data
from
elsewhere,
without
waiting for
the user to do
something!
request
JavaScript Engine
HTML
HTML/ /CSS
CSS
data
data
XML
XML
data
data
JavaScript
JavaScript
code
code
data
other
other
data
data (e.g.
(e.g.
images)
images)
XML data support. Browsers can now store XML data, and access / manipulate
from JavaScript programs via the JavaScript engine.
XMLHttpRequest()
A
control
JavaScript
B
data
XML, other formats
(e.g. images)
C
display
HTML and CSS
Ajax: Pattern
Trigger
Operation
Update
Pattern O- Matic
Ajax : XHR
catch( err2 )
{
try
{
request = new ActiveXObject( Microsoft.XMLHTTP);
// some other IE versions
}
catch( err3 )
{
request = false;
}
}
}
return request;
}
XMLHttpRequest Properties
onreadystatechange
Event handler that fires at each state change
You implement your own function that handles this
0 = uninitialized
1 = loading
2 = loaded
3 = interactive (some data has been returned)
This is broken in IE right now
4 = complete
status
HTTP Status returned from server: 200 = OK
responseText
String version of data returned from server
responseXML
XML DOM document of data returned
statusText
Status text returned from server
XMLHttpRequest
function doResp() {
if _ajax.readyState == 4 and
_ajax.status != 200 {
div=document.getElementById(status)
div.innerHTML = _ajax.responseText;
Message
status=999
msg=Not a valid name
Database
Save
<div
id=status
Not
a Valid
Name >
Client/Browser
Server
Structure of System
Client/Server architecture
XMLHTTP object is used to make request
and get response in Client side
Request can be done via GET or POST
methods
GET: parameters are attached to the url used
to connect.
POST: parameters are sent as parameters to
a function
*These issues will not be discussed as they are not specific to accessibility.
Back Button
Make it work as an undo?
Refresh Button
Save state in <body onload> method?
Ajax Disadvantages
Client Side
Poor compatibility with very old or obscure browsers, and many
mobile devices.
Limited Capabilities like multimedia, interaction with web-cams
and printers, local data storage and real time graphics.
The first-time long wait for Ajax sites.
Problem with back/forward buttons and bookmarks.
Developer Side
Easily Abused by bad programmers.
Not everyone have JavaScript enabled.
Too much code makes the browser slow.
Trends in Market
IBM
IBM
IBM AJAX Toolkit Framework
Eclipse framework support for AJAX Toolkits
Collaboration with Open Source
Mircosoft
Mircosoft
AJAX.net(code-named Atlas)
It will work across any Web browser that supports AJAX technologies
But it is not compatible with others(AJAX-style)
Others
Others
Yahoo : give the user a feeling that they are no longer in a browser
Oracle : Application Server 10g release 3, Support AJAX
Google : trogdor, an ajax webpage editor
Sources
http://ajaxpatterns.org
http://www.telerik.com/products/ajax/historyof-ajax.aspx
http://alexbosworth.backpackit.com/pub/67688
http://ajaxian.com/by/topic/usability/
http://en.wikipedia.org/wiki/Ajax_(programmin
g)
Q & A ???
Thank You
Contact Details:
Bhanwar Gupta
bhanwar.gupta@jsw.in
For your own Unlimited Reading and FREE eBooks today, visit:
http://www.Free-eBooks.net
Share this eBook with anyone and everyone automatically by selecting any of
options below:
COPYRIGHT INFORMATION
Free-eBooks.net respects the intellectual property of others. When a book's copyright owner submits their work to Free-eBooks.net, they are granting us permission to distribute such material. Unless
otherwise stated in this book, this permission is not passed onto others. As such, redistributing this book without the copyright owner's permission can constitute copyright infringement. If you
believe that your work has been used in a manner that constitutes copyright infringement, please follow our Notice and Procedure for Making Claims of Copyright Infringement as seen in our Terms
of Service here:
http://www.free-ebooks.net/tos.html