On Thu, 11 Nov 2010 08:15:33 -0200, Richard Hill <r...@su3analytics.com>
wrote:
In T5, 5.1 you can do something like this. In .tml:
<t:if test="showTitle">
<span>${reportTitle}</span>
...
<t:parameter name="else">
<span>No report to display</span>
</t:parameter>
</t:if>
I believe the "else" syntax may have changed in T5.2.
There are now two syntaxes for passing values to parameters that are
blocks: <t:parameter name="xxx"> (Tapetry 5.0+) and <p:xxx> (Tapestry
5.1+).
I like to write if/else's this way:
<t:if test="showTitle">
<span>${reportTitle}</span>
</t:if>
<t:if test="!showTitle">
<span>No report to display</span>
</t:if>
Better yet, using invisible instrumentation (I love my templates to look
like HTML):
<span t:type="If" t:test="showTitle">${reportTitle}</span>
<span t:type="If" t:test="!showTitle">No report to display</span>
Still better yet, moving all the logic to the class, as there's always a
<span>:
public boolean getReportTitle() {
return reportId > 0 ? reportTitle : "No report to display";
}
<span>${reportTitle}</span>
:)
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org