Tuesday, January 17th, 2006

WebWork 2.2 Released: Solid Ajax Support

Category: Java, Toolkit

WebWork

WebWork 2.2 is an opensource Java web application framework that was just released.

WebWork 2.2 provides several unique AJAX features by building on top of DWR and Dojo. These features are: on-the-fly client side validation, a tabbed panel widget, remote div support, and remote form support.

Client side validation:
On every “onblur” event for form elements (textfield, select, textarea, etc), all form elements that have already been touched (value entered or otherwise selected) will be submitted, using DWR, to a server-side validation API. The validation rules on the server can include simple pre-packaged validators, such as “required” or “intrange”, or even complex validation rules written in Java code that consult data sources, such as “is username unique”.

If there are any validation errors, the results are transmitted back to the browser. Then some simple JavaScript manipulates the DOM structure to dynamically insert error messages or remove no-longer- relevant error messages.

By default, the DOM structure and form layout uses a simple two- column approach where labels are on the left hand side and the form elements are on the right hand side. However, you can easily override the HTML template and JavaScript code to produce any structure you like.

Tabbed Panel Widget:
The tabbed panel widget supports “local” and “remote” contents for each tab. A local tab means that the content was included when the original HTML rendered. Likewise, the content is not re-rendered every time the tab is selected. Remote tabs, on the other hand, have their contents requested from a user-specified URL every time the tab is selected. This allows for you to build tab layouts with complex contents in an extremely modular manner.

Note: Dojo now has it’s own tabbed panel widget. Soon the WebWork team will work with Dojo to integrate the WebWork Tabbed Panel Widget with Dojo’s built in tabbed panel widget.

Remote Div Support:
WebWork also allows you to build easy div blocks that are bound to a URL. The output of the URL is automatically inserted in to the contents (innerHTML) of the div. The URL is requested using two
techniques: on a repeating basis with a configurable time period, or using Dojo’s pub/sub event model by subscribing to a particular “topic”.

Remote Link Support:
WebWork can also allow you to easily build links that bind to a URL that returns JavaScript code. The JavaScript can be static or, more often, generated dynamically. When the link is clicked, the URL is requested and the resulting JavaScript is evaluated in the browser.
This allows you to build actions that, for example, update the code in the background and then return JavaScript that updates the UI to indicate success.

In addition, you can specify a “topic” that is notified when the link is clicked. This can be combined with the Div support to force chunks of content to be re-rendered.

Remote Form Support:

You can also bind any standard form to a div ID. When the form is submitted, the content returned by submitting the form (GET and POST are supported) is placed inside the contents of any specified HTML ID element. For example, you could provide a div ID and have the contents loaded in that other HTML location. Or, you could provide the form’s own ID, ensuring that the form replaces itself once it has been successfully submitted.

Posted by Dion Almaer at 2:07 am
4 Comments

+++--
3.9 rating from 52 votes

4 Comments »

Comments feed TrackBack URI

[…] Opensymphony WebWork is a quality Java web framework than is known for its simplicity, in a world of complexity. WebWork recently had a 2.2 release that offered up a ton of Ajax features, so we wanted to get the thoughts from a server-side web framework developer on what Ajax means to them. […]

Pingback by Ajaxian » Audible Ajax Episode 13: Patrick Lightbody of WebWork — January 23, 2006

[…] It was recently announced that the Java framework WebWork 2.2 will be released with Dojo under the hood, so this looks like another vote of confidence from the open source community in Dojo’s quality. […]

Pingback by Ajaxian » Django adopts Dojo as Ajax framework — January 31, 2006

[…] DWR, Direct Web Remoting for Java, has a new 1.1 release candidate available for download. DWR has quickly become the leading open-source Java library for proxy-based remoting of your server side objects. Its also bundled with the popular WebWork framework. […]

Pingback by Ajaxian » Direct Web Remoting (DWR) 1.1 RC1 released — February 20, 2006

[…] showcase app. Knowning the difference between a local and remote panel is not obvious.   [link] « Webwork AJAXValidation […]

Pingback by A MattPayne.org blog » Blog Archive » Ajaxian » WebWork 2.2 Released: Solid Ajax Support — April 26, 2006

Leave a comment

You must be logged in to post a comment.