Transcript AJAX - MD ColdFusion User's Group
AJAX Daniel Daugherty [email protected]
What is AJAX
Asynchronous JavaScript and XML Other terms to know XMLHttpRequest JSON
What is AJAX used for
Data retrivial Send data to the server for processing.
Form Validation Anything you might load a new page for.
It is possible to build “One Page” Ajax Applications.
What is AJAX NOT
AJAX is NOT DHTML
AJAX is commonly used allong with DHTML to provide enhanced user interface. But they are 2 separate things.
How to implement AJAX Write XMLHttpRequest your self.
Use a AJAX Framework.
Many many many many frameworks out there. DWR for JAVA AJAX.CFC + DWR.CFC for Coldfusion.
DWR Setup
Download DWR – http://getahead.ltd.uk/dwr/ Install DWR.jar in your J2EE server classpath.
Edit web.xml to add the DWR as a servlet.
Edit DWR.XML to list objects to be made available via AJAX.
AJAX.CFC /DWR.CFC
Unzip AJAX.zip into a folder in your web root. Edit DWR.XML to list objects to be made available via AJAX
How do I call DWR/AJAX.CFC
JS templates are needed engine.js util.js optional but recomeneded .
JAVA dwr/interface/[JavascriptName].js
ColdFusion ajax_js_stub.cfm?component=[JavascriptName] wddx.js
Demo
Security
Limit the type of things available via AJAX.
Java Supports restriction with J2EE roles Security Filter.
ColdFusion Application.cfm or Application.CFC
cflogin roles
Error Handling
Client Side DWREngine.setWarningHandler() DWREngine.setErrorHandler() Server Side May need to adjust server side error trapping to be AJAX aware.
Debugging
Server side LOG files are your friend. Client Side Firefox Javascript Debugger Firebugs HTTP Trace utility Javascript alert() DDumper.js - Comes with AJAX.CFC