MWT features a taglib engine, called Phable, that enables users to write widgets using a tag-based language similar
to XHTML but with a richer, extendible set of tags. People familiar to web programming in JSP already
know the beauty and magic of taglibs: MWT implementation of taglibs is very similar to JSTL.
Tags offer many benefits with respect to the traditional ways of coding pages for web sites (mixing
scripting code with HTML, adopting a templating system to separate presentation from business login etc.)
and have proven to be particularly suitable and useful for mobile site development, mainly because of
the following aspects:
- Readibility: by using taglibs to write web pages the code
is easier to be read, understood and mantained.
- Semplicity: writing dynamic web pages using taglibs is often
as easy as writing plain HTML pages, there is no need to learn a new scripting language.
For its similarity to HTML
a language based on tags is easy to digest even for people that don't have a strong technical skill.
- Reusability: tags can output code, graphics or provide a specific
functionality. Putting business logic in tags is a way to favor modularity: a tag can be considered as a reusable
component that can be embedded in several pages or reused in different web sites.
- Conformity to XML syntax: mixing scripting code and XHTML breaks the XML
syntax of the document. Document validation is an important aspect of mobile site development as it is well known
that mobile web browsers are not very tolerant to syntax errors and broken tags: if a page is not a valid XHTML
document the output rendered is often unpredictable.
When using taglibs in XHTML pages the XML syntax of the document is mantained and therefore validation is still
possible.
- Adaptation and multiserving: in a framework that aims to provide
multiserving for different devices and an adaptation engine for mobile web development taglibs offer great
advantages: when rendering the document tags can expand themselves to produce different code and XHTML
depending on the device that has requested the document. Taglibs also provide a way to control, validate and limit
XHTML tags and their usage.
- Dynamic CSS generation: as have already said in Chapter 1: Styles
the expression language that couples MWT's taglibs enables you to script the template style sheet