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

Parameters

Name Type Required Default Description
condition boolean yes The condition to evaluate.
conditionValue boolean no The value of the condition. During render this is obtained from the condition parameter. During rewind it is the submitted condition.
listener IActionListener no The listener is called before the component renders itself, regardless of the value of the condition parameter.
renderTag boolean no true Specifies whether or not to render the html tag name used to reference this component. This logic also deprecates the element parameter in that tag names are already captured from the html temlpate read in, so you only need to tell the component to render or not render whatever tag you used.
element String 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.

This parameter is now deprecated in favor of the new renderTag parameter, the element tag to render is implied by the html used to reference the component now.
volatile boolean 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>
...