views:

23

answers:

1

From my java code I'm returning a Set<String>. The view needs to check if the Set contains a specific string.. I can't find any docs on how Freemarker can handle this.
Any idea?

A: 

The following should do it. You need FreeMarker 2.3.1

${x?seq_contains("blue")?string("yes", "no")}

This will output yes if the sequence contains "blue".

Here is the doco about it Built-ins for sequences

Iain
this works <#if mySet?seq_contains("myString")>
al nik