4.1. Implicit and Explicit Component Usage

The usage of a component can be declared either in the container component's template or in its specification. Components declared in the template are called Implicit components and those declared in the specification are called Explicit components. Implicit components have to be configured in the placeholder tag in its entirety while Explicit components can be configured either in the template or in the specification or partly in the template and partly in the specification.

4.1.1. Component Declaration in Templates

The placeholder tag is an essential part of component declarations. Component declarations in placeholder tags are specified via the jwcid attribute as shown below.

The placeholder tag in the template is simply a placeholder for the component to be rendered in its place; it will be completely replaced by the output from the component in the final rendered web page. Hence the tag used for the placeholder can be any well-formed XML tag. But typically the placeholder is specified with appropriate HTML tags, so the template can be previewed outside the context of the application.

...
<span jwcid="userName" /> 1 
<span jwcid="@Insert" /> 2 
<span jwcid="userName@Insert" /> 3 
...

1

Explicit component declaration. The component type of an explicit declaration is actually specified in the specification. The jwcid here is simply a unique ID to identify the embedded component in the container.

2

Anonymous implicit component declaration. Implicit declarations have no entry in the specfication as these components are competely configured here in the template. The jwcid here is the actual component type prefixed by the @ symbol. This is an anonymous declaration and hence cannot be referred to from elsewhere.

3

Named implicit component declaration. This is exactly the same as the previous implicit declaration except a unique ID has been assigned to the declaration. This ID can be used to refer back to this component when needed as we will see later. The jwcid here is the component ID and the component type separated by the @ symbol.

4.1.2. Component Declaration in Specifications

Component declarations in specifications are specified via the <component> tag as shown below.

...
<component id="userName 1 type="Insert" 2 >
    ...
    ...
</component>
...

1

Component ID. The ID here is the same ID that is assigned to the component via the template jwcid attribute.

2

Component type. The type is what determines the type of component to be used.