JEXL——获取当前日期和时间

JEXL – Get current date and time

我必须使用 JEXL 表达式,我需要使用 JEXL 获取当前年份和月份。可能吗?

您可以使用 JETT 允许在 JEXL 代码中调用静态方法:

ETT extends JEXL to allow references to static methods directly in JEXL Expressions

然后调用(Java8)LocalDateTime.now方法获取当前日期和时间:

${java.time.LocalDateTime.now()}