I put a list strings as validTypes
in velocity. When I do :
#if (${validTypes}.contains("aaa"))
// do something
#end
it throws an error. But when I do :
#foreach (${validType} in ${validTypes})
${validType}
#end
it works fine. Do I need to use velocity tools for this? How do I use it in an eclipse plugin? Are there any work around without using velocity tools?
Velocity templates were deprecated in Liferay Portal 7.0 and are now removed in favor of FreeMarker templates in Liferay DXP 7.2.
The #macro directive allows you to name a section of a VTL template and re-insert it multiple times into the template.
1 answer. Or in your Java code, try: URL url = new URL("image. png");
The Apache Velocity Engine is a free open-source templating engine. Velocity permits you to use a simple yet powerful template language to reference objects defined in Java code. It is written in 100% pure Java and can be easily embedded into your own applications.
The problem here is in curly brackets. Just use
#if (${validTypes.contains("aaa")})
or
#if ($validTypes.contains("aaa"))
instead.
For those who concern, this is how to write if not,
#if (!$validTypes.contains("aaa"))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With