I need to get 2 java fields in the one Tapestry table column. Every of my fields can be null. Can I write if condition in single line (2 fields in one IF operator), or I must write inner condition for second field?
Now I have this:
<t:if test="${subject.subjectQuantity}">
<t:if test="${subject.unitMeasure}">
<tr>
<td>Subject count:</td>
<td>${subject.subjectQuantity} ${subject.unitMeasure}</td>
</tr>
</t:if>
</t:if>
JAVA
public boolean isSubjectQuantityAndUnitMeasurePopulated() {
return subject.subjectQuantity != null && subject.unitMeasure != null;
}
TML
<t:if test="subjectQuantityAndUnitMeasurePopulated">
<tr>
<td>Subject count:</td>
<td>${subject.subjectQuantity} ${subject.unitMeasure}</td>
</tr>
</t:if>
You can have any no of condition in your java code. Please refer below code.
Scrub.tml
<t:if test="sitelistUtility">
<label> ${sitelist.utility.name}</label>
</t:if>
Scrub.java
public boolean isSitelistUtility() {
return sitelist != null && sitelist.getUtility() != null;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With