Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
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?
You can use
seq_contains
. You need FreeMarker 2.3.1
${x?seq_contains("blue")?string("yes", "no")}
This will output yes if the sequence contains "blue".
And from the comments, if you want this in an if statement
<#if x?seq_contains("myString")>
Here is the doco about it Built-ins for sequences
–
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.