WebWork + AJAX A winning combination Patrick A. Lightbody.

Slides:



Advertisements
Similar presentations
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 16 Introduction to Ajax.
Advertisements

1/7 ITApplications XML Module Session 8: Introduction to Programming with XML.
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
JQuery A Javascript Library Hard things made eas(ier) Norman White.
HTML 5 and CSS 3, Illustrated Complete Unit L: Programming Web Pages with JavaScript.
Lesson 12- Unit L Programming Web Pages with JavaScript.
ProJAX An AJAX Framework for Progress Tom Bascom President Greenfield Technologies
6/3/2015eBiquity1 Tutorial on AJAX Anubhav Kale (akale1 AT cs DOT umbc DOT edu)
AJAX Presented by: Dickson Fu Dimas Ariawan Niels Andreassen Ryan Dial Jordan Nielson CMPUT 410 University of Alberta 2006.
AJAX & By – Anupama Sharma. Defining Ajax Ajax isn’t a technology. It’s really several technologies, each flourishing in its own right, coming together.
Dynamic Web Pages Bert Wachsmuth. Review  Internet, IP addresses, ports, client-server, http, smtp  HTML, XHTML, XML  Style Sheets, external, internal,
Computer Science 103 Chapter 4 Advanced JavaScript.
Does Ajax suck? CS575 Spring 2007 Chanwit Suebsureekul.
Introduction to JavaScript. Aim To enable you to write you first JavaScript.
Web 2.0 with AJAX Students : LASC Ioana KELEMEN Csilla POP Dan Adrian CIOBANU Dumitru Daniel Project leader : Ahmed RHIAT.
Chapter 6 DOJO TOOLKITS. Objectives Discuss XML DOM Discuss JSON Discuss Ajax Response in XML, HTML, JSON, and Other Data Type.
JQuery CS 268. What is jQuery? From their web site:
WebWork in Action An introduction to WebWork Patrick A. Lightbody.
Ryan Putz. Outline  What is Ajax?  Member Technologies  Methodology  When and When Not To Use  Who’s Using Ajax?  Code Examples.
Javascript and the Web Whys and Hows of Javascript.
NextGen Technology upgrade – Synerizip - Sandeep Kamble.
JavaScript & jQuery the missing manual Chapter 11
CS 4720 RESTfulness and AJAX CS 4720 – Web & Mobile Systems.
May 16 – 18, 2007 Copyright 2007, Data Access Worldwide May 16 – 18, 2007 Copyright 2007, Data Access Worldwide Build Great Web Application 'Fast and Easy'
Ruth Betcher Ruth Christie
ASP.NET + Ajax Jesper Tørresø ITNET2 F08. Ajax Ajax (Asynchronous JavaScript and XML) A group of interrelated web development techniques used for creating.
Ajax Runtime Toolkits IBM Emerging Technologies. What is an AJAX Toolkit/Framework? An AJAX Toolkit/Runtime is more than just XMLHTTPRequest Should includes:
Using Styles and Style Sheets for Design
AJAX Without the “J” George Lawniczak. What is Ajax?
Lesson 4: Using HTML5 Markup.  The distinguishing characteristics of HTML5 syntax  The new HTML5 sectioning elements  Adding support for HTML5 elements.
Event Handlers CS101 Introduction to Computing. Learning Goals Learn about event handlers Determine how events are useful in JavaScript Discover where.
JDeveloper 10g and JavaServer Faces: High-Performance UIs on the Web Avrom Roy-Faderman Senior Programmer May, 2006.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
Intro to Ajax Fred Stluka Jan 25, /25/2006Intro to AjaxFred Stluka2 What is Ajax? "Asynchronous JavaScript and XML" New name for an old technique:
Lesson 19. JavaScript errors Since JavaScript is an interpreted language, syntax errors will usually cause the script to fail. Both browsers will provide.
AJAX and Atlas in ASP.NET 2.0 William J. Steele MSDN Developer Evangelist Microsoft Corporation
Matrix Mapping Tool Sam Gross Internship at Virtual Technology Corporation.
JavaScript, Fourth Edition
Introduction to JavaScript 41 Introduction to Programming the WWW I CMSC Winter 2004 Lecture 17.
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
JavaScript, jQuery, and Mashups Incorporating JavaScript, jQuery, and other Mashups into existing pages.
Javascript Intro
Asynchronous Javascript And XML AJAX : an introduction UFCEUS-20-2 : Web Programming.
Unleash the Power of jQuery Learning & Development Team Telerik Software Academy.
JQuery JavaScript is a powerful language but it is not always easy to work with. jQuery is a JavaScript library that helps with: – HTML document traversal.
the acronym for Asynchronous JavaScript and XML.
Ajax for Dynamic Web Development Gregory McChesney.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
Unit 13 –JQuery Basics Instructor: Brent Presley.
Document Object Model Nasrullah. DOM When a page is loaded,browser creates a Document Object Model of the Page.
AJAX Use Cases for WSRP Subbu Allamaraju BEA Systems Inc WSRP F2F Meeting, May 2006.
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
APACHE STRUTS ASHISH SINGH TOMAR ast2124. OUTLINE Introduction The Model-View-Controller Design Pattern Struts’ implementation of the MVC Pattern Additional.
Chapter 10 Dynamic HTML (DHTML) JavaScript, Third Edition.
JQUERY AND AJAX
AJAX. Objectives Understand and apply AJAX Using AJAX in DOJO library.
A S P. Outline  The introduction of ASP  Why we choose ASP  How ASP works  Basic syntax rule of ASP  ASP’S object model  Limitations of ASP  Summary.
Client-side (JavaScript) Validation. Associating a function with a click event – Part 1 Use the input tag’s onclick attribute to associate a function.
Technologies For Creating Rich Internet Applications Presenter's name
JQuery Fundamentals Introduction Tutorial Videos
Tutorial 6 Topic: jQuery and jQuery Mobile Li Xu
Application with Cross-Platform GUI
Haritha Dasari Josue Balandrano Coronel -
Unit 6-Chapter 2 Struts.
AJAX.
DWR: Direct Web Remoting
jQuery The Easy JavaScript Nikolay Chochev Technical Trainer
SEEM4570 Tutorial 5: jQuery + jQuery Mobile
Intro to Ajax Fred Stluka Jan 25, 2006.
Presentation transcript:

WebWork + AJAX A winning combination Patrick A. Lightbody

Introduction What is WebWork? What is OpenSymphony? The state of web applications  Yesterday, today, and tomorrow Who is Patrick? Is AJAX here to stay?

eBook now available Print version ready “any day now” A free copy will be given away at the end of the session

AJAX AJAX = Asyncronous JavaScript and XML Examples  Gmail  Google maps  Jive group chat  Microsoft Outlook Web Access All use XmlHttpRequest  Platform compatibility?

A simple action A look at the general flow of WebWork actions A simple example of the template library’s power Remember: all the AJAX features of WebWork are built using the template library AJAX is really just a bunch of JavaScript, HTML, and sloppy logic smashed together in a big train wreck!

Clean code… action="createPerson" method="post"> label="Name" name="person.name"/> label=" " name="person. "/>

… is still really a train wreck <form id="updatePerson" action="updatePerson.action" method="post"> Name: <input id="updatePerson_person.name" name="person.name"/>...

Uses of AJAX What exactly does it mean to “ajaxify” your web application? AJAX is a technique; not a technology. Caution: AJAX can be overused! Common AJAX techniques:  Tabbed pane  Validation  Polling  Tree widget

Building blocks Three core building blocks/tags: divs are where things “happen” Links and submit buttons can trigger events

Building blocks (cont) Two frameworks used:  DWR: Remote invocation service for Java JavaScript  Dojo: Language/server-agnostic JavaScript framework Two styles of AJAX:  DOM manipulation (DWR)  "Partial pages" (Dojo) WebWork provides three Dojo widgets:  BindDiv  BindAnchor  BindButton

Div tag Attributes:  href  updateFreq  delay  loadingText  errorText  showErrorTransportText  listenTopics  afterLoading Usage:

Polling Simple use of tag!  Just set the href and the frequency Note: remote action returns HTML Example: id=“url” value=“mailbox.action” mailboxId=“${mailboxId}”/>

Stock quote example id="url" value="quote.action" symbol="${symbol}"/> href="%{#url}" updateFreq="900000"/>

Stock quote example (cont.) public class Quote { String symbol; Stock stock; public String execute() { stock = StockMgr.lookup(symbol); return SUCCESS; }

Stock quote example (cont.) ${stock.symbol}: ${stock.price}

Stock quote example (cont.) <div dojoType="BindDiv" href="quote.action?symbol=GOOG" refresh="900000"/>

Compatibility That's great, but what about older browsers? With the stock quote example, they would see nothing! WebWork and Dojo address this as much as possible Warning: Intelligent fallback can be difficult and sometimes impossible!

Compatibility href="%{#url}" updateFreq="900000"> name="quote" symbol="${symbol}" executeResult="true"/>

Compatibility (cont.) <div dojoType="BindDiv" href="quote.action?symbol=GOOG" refresh="900000"> GOOG: $82,000.00

Tabbed pane Two tags: The panel tag extends the div tag  tabName  remote Usage:

Tabbed Pane

Example Stock details... remote="true" tabName="Price" href="%{#url}"/>

Topic-based events Dojo supports an event system, donated by the WebWork developers Any element, such as a div, may listen on multiple topics Any element, such as an href or tab header, may notify a topic What happens when the topic is notified is up to the receiving element Important: topics get you away from document.getElementXxx()

Tree widget: events in action A tree widget is actually one of the simplest AJAX techniques to build Assume a model that provides a getChildren() call, such as Category.getChildren() Utilizes two building blocks: divs and links.

Tree widget

Tree widget example Requirements:  An action that gets a list of children when given a category ID  A template to render the tree  A template to kick off the initial tree display  An action that returns JavaScript as the result Initial display can be done with the action tag: name="listCategories.action" executeResult="true"/>

Tree widget example 0> notifyTopics="children_${cat.id}" href="toggle.action?id=${cat.id}"> [EXAMPLE CONTINUED]

Tree widget example id="url" value="listCategories.action" id="${cat.id}"/> id="children_${cat.id}" cssStyle="display: none" href="%{#url}" listenTopic = "children_${cat.id}"/>

Tree widget example if (${childCount} > 0 { var div = $("children_${id}"); var style = div.style; if (style.display == "none") { style.display = ""; } else { style.display = "none"; }

Validation Uses DWR; requires the DWR servlet installed Note: remote calls return serialized objects (not HTML "partials") Is a very different style of AJAX Uses onBlur events Example: action="createPerson" validate="true">...

Validation

Pitfalls Remember: there is no silver bullet At the end of the day, your application is still a web site - don’t forget that Excessive polling can lead to extreme load and/or thread starvation Common functionality, such as the back button and printing, can become difficult or confusing for the user Browser incompatibility can lead to two versions of the same application (see gmail)

Wrap up Built in WebWork features:  Tabbed pane  Validation  Polling  More coming soon! A mix of AJAX technologies - the space is very fragmented (much like Java web frameworks!)

Questions?