Comparison of Tapestry and wicket

Source: Internet
Author: User
Tags comparison

Need to quickly create a Web application? Take a look at the two component frameworks.

Tapestry and Wicket are touted as popular component-based modern WEB frameworks. Unlike the Model 2 framework Struts or Spring MVC, Tapestry and Wicket provide a new way for web development processes to consider Web applications and their behavior and component interactions in the same way as a GUI-independent application.

A typical component-based application represents a collection of pages, consisting of a set of components. These components may be assembled from smaller components. User interaction is a specific component event. This is the main difference from an MVC based application, where the interaction entry point is a servlet or an operation with a generic attribute (such as a URL and its parameters, forms, and so on).

Developers who use component-based frameworks focus on component and component interaction by implementing an event-driven model. Servles, HTTP sessions, and other entities from the servlet API are moved to a lower level and are never used directly. However, by declaring components and their properties, developers need to manage server-side state, which may be session persistence.

Unlike JSF or webworks using JSP and Velocity tags, both Tapestry and Wicket use their own template systems to allow the creation of HTML templates that fully conform to HTML standards. This allows for a clear separation of concerns: the Web designer who is engaged in the GUI does not have to think about what platform the application is written on, and the developers of the application implementing the component do not have to consider whether the final design of the page will be debugged and tested with stub elements. Both Tapestry and Wicket support this separation.

Tapestry List

Currently, Tapestry V4.1 is the official release of the project. V5.0 is currently in active development, more than 18 months since the team began writing Tapestry from scratch and writing this article. Although V5.0 has not been published publicly, it is quite certain that it is completely different from the previous version because it is not backwards compatible. Because we cannot determine the state of V5.0, we mainly focus on V4.1.

Tapestry V4.1 is mainly based on the Hivemind microkernel, which is a strict representation of the control inversion (Inversion-of-control) container. All Tapestry services are registered using the Hivemind.

A typical Tapestry component is assembled from the following sections: A component description (an XML descriptor), Component logic (part of the Java™ programming language), UI layout (an HTML module).

Wicket List

The core of the Wicket architecture is the component class, which is extended by all components and markup containers. The component is primarily responsible for processing an implementation of its model-imodel interface. A model represents any type of data associated with a component instance and defines its behavior. A notable implementation in Imodel is Loadabledetachablemodel, which allows temporary data to be passed, loads data before the component is rendered, and removes it when it is not needed (undo), thereby reducing the size of the Wicket session.

Wicket pages are also components and, if they have states, their states are saved in the Wicket session. Pages can be enabled, so whenever the page state changes (viewing the page, modifying its component state, and so on), it is saved with an incremented version number.

Development process

This section describes how to accomplish typical tasks in Tapestry and Wicket. Note that the following code snippets are mostly taken from larger code sources, such as components and pages. Therefore, they may contain calls to some of the business methods that are not described here.

Supported data types

Both of these frameworks support Java data types. Tapestry uses the object map navigation language (object-graph navigation language,ognl). It is an expression language that gets and sets the properties of a Java object. Wicket uses its unique mechanism for data binding. There are two convenient implementations for dynamically retrieving and updating object properties: Propertymodel and Compoundpropertymodel.

Let's look at an example that applies a float type. In Tapestry, specify a text field with a float value in the following ways:

Listing 1. Tapestry code Example

<component id="weight" type="TextField">
     <binding name="value" value="ognl:weight"/>
     <binding name="translator" value="translator:number,pattern=#.#"/>
     <binding name="displayName" value="literal:Weight"/>
   </component>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.