2012-10-16 39 views
0

我要顯示其類型可以是1或4或5如何寫在GSP頁使用GPATH條件表達式

${attachments} has got attachments with the attributes name, type

EDIT附件:

<g:findAll in="${attachments}" expr="it.type==1 || it.type==4 || it.type==5"> 
     <p>File: ${it.name}, ${it.type}</p> 
    </g:findAll> 

我嘗試上述方法,它沒有工作,如何做到這一點。

回答

0
<g:each in="${attachments.findAll{[1,4,5].contains(it.type)}}"> 
    <p>File: ${it.name}, ${it.type}</p> 
</g:each> 
+0

我編輯了帖子 – n92

+0

我剛剛編輯過 –