Apache Tiles Learning (i), composite view mode _apache

Source: Internet
Author: User
Tags comparison table
Absrtact: The project needs to use Apache Tiles, now study and leave the relevant records to stay or continue to see and learn from each other. What is Apache Tiles.

A Free open-sourced Templating framework for modern Java applications.

Based upon the composite pattern it are built to simplify the development of user interfaces.

For complex web sites it remains the easiest and most elegant way to work the No MVC alongside.

A free and open source template framework for modern Java applications.

Based on the composite pattern, it is built to simplify the development of the user interface.

For complex sites, but it still works together, any of the MVC techniques are the simplest and most elegant way. Composite view mode (the composite view pattern)

All sites have one thing in common: they are web pages with similar structure. Pages share the same layout, while each page is made up of separate accessories, but always placed in the same location as all sites.

This typical use is formalized by the composite view mode, which allows you to create pages with similar structure, where each part of the page differs in different circumstances. How the composite view mode works.

To understand this pattern, let me give you an example. From the image below you can see a typical web page structure.


This structure is called the "typical layout (classic layout)". This template organizes the page according to this layout, puts each piece in the position where it is needed, so the header part is on, the footer part is down, and so on.

This can happen if you click a hyperlink to jump to another page, and the other page needs to change only a part of it, usually the body part.

As you can see, this page is different, but their differences are only the body part. Note that although the page is different, it is not like refreshing the frame in frameset.

Using the compound view mode, the rest of the page can be reused, and the consistent layout is saved. The role of the View assistant

Each part of a composite view can have a view assistant. This pattern displays the data that is prepared for each section according to the layout of the page, such as: Creating a menu.
Composite View vs Adorner (decorator)

Tiles is a composite view framework: It allows you to reuse pages throughout your application. Reusable pages can also be implemented through adorner mode. For example: Sitemesh is an adorner based mode.

By creating a template (template) to organize each page to the same page, the adorner pattern requires a simple HTML page, adding the missing part (in our example above, adding Header,footer and menu) to the final rendering of it.

Here is a comparison table of the two modes

Table

Aspect Compound view Adorner Reusable page parts (template and page blocks) can be reused throughout the application with all adorners, but decorating their own adorners at the same time can only be applied to a page configuration complexity each page must be defined exactly to define the adorner that can be applied to the entire application runtime configuration  The page can be configured at run time because a page is decorated at a time, and his features are not rendered. Performance low cost combination pages need parsing to decorate
Reprint: https://my.oschina.net/jast90/blog/283254

Reference:

Official documents

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.