Dynamic markup in Tapestry attempts to be invisible. Components are arbitrary tags containing a jwcid
attribute. Such components must be well balanced (have a matching close tag, or end the tag with "/>
".
Generally, the id specified in the template is matched against an component defined in the specification. However, implicit components are also possible. The jwcid attribute uses the syntax "@Type
" for implicit components. Type is the component type, and may include a library id prefix. Such a component is anonymous (but is given a unique id).
(The unique ids assigned start with a dollar sign, which is normally no allowed for component ids ... this helps to make them stand out and assures that they do not conflict with user-defined component ids. These ids tend to propagate into URLs and become HTML element names and even JavaScript variable names ... the dollar sign is acceptible in these contexts as well).
Implicit component may also be given a name using the syntax "componentId:@Type
". Such a component should not be defined in the specification, but may still be accessed via {@link org.apache.tapestry.IComponent#getComponent(String)}.
Both defined and implicit components may have additional attributes defined, simply by including them in the template. They set formal or informal parameters of the component to static strings. {@link org.apache.tapestry.spec.IComponentSpecification#getAllowInformalParameters()}, if false, will cause such attributes to be simply ignored. For defined components, conflicting values defined in the template are ignored.
Attributes in component tags will become formal and informal parameters of the corresponding component. Most attributes will be
The parser removes the body of some tags (when the corresponding component doesn't {@link org.apache.tapestry.spec.IComponentSpecification#getAllowBody() allow a body}, and allows portions of the template to be completely removed.
The parser does a pretty thorough lexical analysis of the template, and reports a great number of errors, including improper nesting of tags.
The parser supports invisible localization: The parser recognizes HTML of the form: <span key="value"> ... </span>
and converts them into a {@link TokenType#LOCALIZATION}token. You may also specifify a raw
attribute ... if the value is true
, then the localized value is sent to the client without filtering, which is appropriate if the value has any markup that should not be escaped.
@author Howard Lewis Ship, Geoff Longman
@version $Id: TemplateParser.java 244412 2005-07-23 03:32:35Z glongman $
|
|
|
|
|
|