简体   繁体   中英

Apache Velocity IfNotNull

This link describes how to use if not null condition in velocity.

userdirective = org.apache.velocity.tools.generic.directive.Ifnull
userdirective = org.apache.velocity.tools.generic.directive.Ifnotnull

But looking inside velocity tools jar there is no such class org.apache.velocity.tools.generic.directive.Ifnotnull .

What am I missing here?

From your link:

Use a custom directive. cf. IfNullDirective, IfNotNullDirective

You have to put the linked code ( http://wiki.apache.org/velocity/IfNullDirective and http://wiki.apache.org/velocity/IfNotNullDirective ) in your sources, it's not provided in the regular velocity jar.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM