2011-09-27 22 views
0

我不知道我怎樣才能使這個代碼在我看來條件 - 輸出,如果有一個評論,但如果沒有一個評論,不輸出空<p class="comment"></p>Grails的條件HTML

<p class="comment"> 
    ${progressItem.comment} 
</p> 

回答

2
<g:if test="${(progressItem?.comment?.size() > 0)}"> 
    <p class="comment"> 
    ${progressItem.comment} 
    </p> 
</g:if> 
+0

它沒有爲我工作... –

+0

什麼沒有工作呢? –

+0

評論完全沒有顯示。對不起,我沒有包括那 –