when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${PD_CODE} [in template "article.ftl" at line 8, column 111] ---- Java stack trace (for programmers): ---- freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...] at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:108) at freemarker.core.EvalUtil.coerceModelToString(EvalUtil.java:346) at freemarker.core.Expression.evalAndCoerceToString(Expression.java:80) at freemarker.core.DollarVariable.accept(DollarVariable.java:40) at freemarker.core.Environment.visit(Environment.java:257) at freemarker.core.MixedContent.accept(MixedContent.java:57) at freemarker.core.Environment.visit(Environment.java:257) at freemarker.core.Environment.process(Environment.java:235) at freemarker.template.Template.process(Template.java:262) at com.fh.util.Freemarker.printHtmlFile(Freemarker.java:81) at com.fh.thread.ArticleBindThread.createDetails(ArticleBindThread.java:347) at com.fh.thread.ArticleBindThread.createArticlePage(ArticleBindThread.java:205) at com.fh.thread.ArticleBindThread.articleBind(ArticleBindThread.java:148) at com.fh.thread.ArticleBindThread.run(ArticleBindThread.java:58) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)