Wicket 6.0 Brings Out of The Box JQuery And More
Join the DZone community and get the full member experience.
Join For FreeApache Wicket 6.0 gets released today, with a number of enhancements that make it one of the most compelling choices for web development in Java. With JQuery integration provided out of the box, improvements throughout the client side API, and an experimental WebSocket implementation, this should be a popular upgrade for Wicket users.
"This release delivers a reinvigorated implementation of our client side API that enables developers to integrate rich JavaScript libraries and components with minimal effort. We have updated and broadened the capability and flexibility of many existing features throughout the framework," said Martijn Dashorst, Vice President of Apache Wicket.
Here's a quick rundown on what's included.
JQuery Now Available Out-Of-The-Box
Wicket's custom AJAX JavaScript library has been re-implemented using JQuery, so it will be easier to integrate JQuery plugins into Wicket applications. Of course, it's still possible to use your own version of JQuery if required.
AJAX Attributes
With the new and improved AJAX implementation, you can alter any
aspect of an AJAX request through AjaxRequestAttributes. For example you
can specify that the request should be executed using POST instead of
GET, or that the AJAX request should be multi-part, etc. See the
migration guide or the JavaDoc of AjaxRequestAttributes for all possible
options.
Browser event registration replaces inline events
Wicket now uses JavaScript event registration instead of inline
attributes for AJAX components. This enables multiple event listeners to
be attached to a markup tag, cleans up the rendered markup considerably
and reduces the amount of generated markup.
IDataProvider now
uses long instead of int
The IDataProvider<T> interface and
implementations now use long instead of int for index and size
parameters to better line up with the Java Persistence API and other
persistency frameworks. Big data is now possible with Wicket!
${label}
replaces ${input} in feedback messages
Previous Wicket versions used
the input that was provided by users in error messages when validations
failed. This led to error messages like "1234a is not a valid number".
In Wicket 6 the feedback messages use the label of the invalid form
component instead. You can set the label by calling setLabel() on the
form component. If no label is provided, Wicket defaults to
displaying the component identifier. This changes the error message to
"Phonenumber is not a valid number".
Resources can declare
dependencies - It is now much easier to create resource contributions
with dependencies, for example a JQuery plugin can declare a dependency
on JQuery and other resources such as embedded style sheets. Users of
such resources don’t have to provide these dependencies themselves, and
the dependencies are linked in the appropriate order.
Packaged
resources will use minimized version automatically - When a minimized
JavaScript resource is available (filename.min.js – add the .min part to
the filename before the extension), Wicket will automatically use the
minimized version when running in deployment mode, while using the
non-minimized version for development mode.
OSGi compatible
packaging
Wicket's packaging has been made compatible with OSGi bundles by moving some classes to different packages. The full list can be found in our migration guide. This makes it much easier to deploy Wicket applications in an OSGi environment
Experimental websocket implementations
This release also includes two experimental websocket implementations: one using Atmosphere as a bridge for browsers and containers that don’t support websockets natively and one for containers and browsers that have native websocket support.
Java 6 As Minimum Required Version
If your existing Wicket application has been using an earlier Java version, and you want to take advantage of Wicket 6.0 features, you'll need to upgrade your Java runtime too.
The headline features include
- Out-of-the box JQuery integration
- Complete control over AJAX requests
- Improved event registration in browsers
- Support for large datasets in components
- Dependency management for client side JavaScript libraries
- Experimental support for WebSockets
The complete set of changes is available in the migration guide at http://s.apache.org/wicket-6.0-migration
Opinions expressed by DZone contributors are their own.
Comments