If
Conditionally emulates an element and its attributes and/or includes a block of content if a condition is met.
See also: org.apache.tapestry.components.IfBean, Else, Conditional
Parameters
Name | Type | Direction | Required | Default | Description |
---|---|---|---|---|---|
condition | boolean | in | yes | The condition to evaluate. | |
conditionValue | boolean | in | no | The value of the condition. During render this is obtained from the condition parameter. During rewind it is the submitted condition. | |
listener | IActionListener | in | no | The listener is called before the component renders itself, regardless of the value of the condition parameter. | |
element | String | in | no | The element to emulate. If specified, then the component acts like an Any, emitting an open and close tag. Informal parameters are applied to the tag. If no element is specified, informal parameters are ignored. | |
volatile | boolean | in | no | false | Only active in a form. Determines whether to avoid creating hidden fields within a form. Using this parameter may make the form structure different during render and rewind, and cause exceptions as a result. Please use with caution. |
Body: allowed
Informal parameters: allowed
Reserved parameters: name, form
Examples
In this example we say hello to our user if he/she has login, or we ask him/her login.
Home.html
... <p> Hello, <span jwcid="@If" condition="ognl:user.login"><span jwcid="@Insert" value="ognl:user.name"/></span> <span jwcid="@Else">please <span jwcid="@PageLink" page="Login">login</span></span> </p> ...