Any

A "Swiss Army Knife" component that can emulate any tag whatsoever. The Any component renders the tag for its element in the template, plus any informal parameters, and its body. This is typically used to make certain attributes of a tag dynamic without having to write an entire component for that single purpose.

See also: org.apache.tapestry.components.Any , If , For

Parameters

Name Type Required Default Description
element string no From the HTML template The element to render.

Body: allowed

Informal parameters: allowed

Reserved parameters: none

Certain other components, including If and For , can behave much like an Any component, in addition to their normal behavior, by specifying a value for their element parameter.

Example

In this example, the Any component is emulating an <img> element, and is dynamically calculating the URL, width, height, and title from data (presumably obtained from a database).

  
<h2>Thumbails:</h2>

<span jwcid="loop">
  <p>
    <img jwcid="@Any" src="ognl:image.thumbURL" width="ognl:image.thumbWidth" height="ognl:image.thumbHeight"
    alt="ognl:image.title"/>
    <br/>
    <span jwcid="@Insert" value="ognl:image.title"/>
  </p>
</span>

This template is complemented by some details in the specification:

  . . .
  
  <property name="image"/>
  
  <component id="loop" type="For">
    <binding name="source" value="thumbnails"/>
    <binding name="value" value="image"/>
  </component>
  
  . . .

The RenderBlock component contains an extensive example that includes the use of the Any component.