Components are configured by binding their parameters. Binding of parameters may occur inside a page or component template, or a page or component specification.
When binding a component parameter, the value to be bound may be just a literal string,
or it could be an
OGNL
expression, or subject to any of a number of other interpretations. Tapestry uses a
prefix
value, such as ognl:, or message:, to identify how the rest of the value is to be
interpreted. The prefix identifies the
binding type
:
| Binding Type | Description | Example | OGNL Equivalent |
|---|---|---|---|
| asset | References an asset of the component. | asset:stylesheet | ognl:assets.stylesheet |
| bean | References a named bean (defined by a <bean> element). | bean:validationDelegate | ognl:beans.validationDelegate |
| clientId | The clientId of the given component. | clientId:myForm | ognl:components.myForm.clientId |
| component | References a nested component with the provided component id. | component:form | ognl:components.form |
| hivemind | References a HiveMind object, much like <inject> . | hivemind:service:app.MyService | |
| listener | The name of a listener method . | listener:formSubmit | ognl:listeners.formSubmit |
| literal | Used to "escape" a binding prefix, marking the suffix as a literal value. | literal:ognl:not-an-expression | |
| message | References a localized message from the component's message catalog. | message:page-title | ognl:messages.getMessage("page-title") |
| meta | References a meta configured value for a specific component/page or global configuration file. (such as APPNAME.application or FooComponent.jwc) | meta:renderIfTags | n/a |
| ognl | An OGNL expression to be evaluated. | ognl:engine.visit.admin | |
| state | True of false dependening on whether the named application state object exists. | state:visit | |
| translator | Initializer used to obtain and configure a Translator instance. | translator:number,pattern=# | |
| validators | List of configured Validator instances (used with TextField and others). | validators:email,required,minLength=10 |
Most of these are quite straight forward; the validator, validators and translator prefixes require some additional description.
Note:You can define your own prefixes by contributing into the tapestry.bindings.BindingFactories configuration point.
What happens when you omit a binding prefix? In a page or component template , the value it is assumed to be a literal string, as with the "literal:" prefix. In a page or component specification, or inside a Java annotation, the value is assumed to be an OGNL expression, as with the "ognl:" prefix (but even this can be configured). You will occasionally have to use an explicit "literal:" prefix inside such files.
Many of the bindings are driven by a HiveMind configuration; the configuration will define the available values, and contributing the configuration allows new values to be defined.
| Binding Prefix | Configuration |
|---|---|
| translator | tapestry.form.translator.Translators |
| state | tapestry.state.ApplicationObjects |
| validator | tapestry.valid.Validators |