Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/grails/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Grails条件html_Grails - Fatal编程技术网

Grails条件html

Grails条件html,grails,Grails,我想知道如何在我的视图中使这段代码有条件-如果有注释就输出它,但是如果没有注释,就不要输出空的 <p class="comment"> ${progressItem.comment} </p> ${progressItem.comment} ${progressItem.comment} 评论根本不显示。对不起,我没有包括在内 <g:if test="${(progressItem?.comment?.size() > 0)}"> &

我想知道如何在我的视图中使这段代码有条件-如果有注释就输出它,但是如果没有注释,就不要输出空的

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

${progressItem.comment}


${progressItem.comment}


评论根本不显示。对不起,我没有包括在内
<g:if test="${(progressItem?.comment?.size() > 0)}">
  <p class="comment">
    ${progressItem.comment}
  </p>
</g:if>