when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthessis: (myOptionVar.foo)!myDefault, (myOptionVar.foo)?? The failing instruction (FTL stack trace): ---------- ==> ${product.title!""} [in template "myTemplate" at line 13, column 98] #else [in template "myTemplate" at line 10, column 5] ---------- Java stack trace (for programmers): ---------- freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...] at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:98) at freemarker.core.UnexpectedTypeException.newDesciptionBuilder(UnexpectedTypeException.java:41) at freemarker.core.UnexpectedTypeException.(UnexpectedTypeException.java:24) at freemarker.core.Dot._eval(Dot.java:81) at freemarker.core.Expression.eval(Expression.java:111) at freemarker.core.DefaultToExpression._eval(DefaultToExpression.java:116) at freemarker.core.Expression.eval(Expression.java:111) at freemarker.core.Expression.evalAndCoerceToString(Expression.java:115) at freemarker.core.DollarVariable.accept(DollarVariable.java:76) at freemarker.core.Environment.visit(Environment.java:265) at freemarker.core.MixedContent.accept(MixedContent.java:93) at freemarker.core.Environment.visitByHiddingParent(Environment.java:286) at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:86) at freemarker.core.Environment.visit(Environment.java:265) at freemarker.core.MixedContent.accept(MixedContent.java:93) at freemarker.core.Environment.visit(Environment.java:265) at freemarker.core.IfBlock.accept(IfBlock.java:84) at freemarker.core.Environment.visit(Environment.java:265) at freemarker.core.MixedContent.accept(MixedContent.java:93) at freemarker.core.Environment.visit(Environment.java:265) at freemarker.core.Environment.process(Environment.java:243) at freemarker.template.Template.process(Template.java:277) at com.youboy.shop.engine.TemplateEngine.writeTemplate(TemplateEngine.java:66) at com.youboy.shop.web.controller.ProDetailController.proDetail(ProDetailController.java:459) at sun.reflect.GeneratedMethodAccessor338.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:212) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:900) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778) at javax.servlet.http.HttpServlet.service(HttpServlet.java:120) at javax.servlet.http.HttpServlet.service(HttpServlet.java:97) at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:109) at com.caucho.server.webapp.DispatchFilterChain.doFilter(DispatchFilterChain.java:131) at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:289) at com.caucho.server.webapp.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:298) at com.caucho.server.webapp.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:116) at com.youboy.shop.filter.ShopInfoFilter2.doFilter(ShopInfoFilter2.java:232) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89) at com.youboy.shop.filter.SecondDomainFilter.doFilter(SecondDomainFilter.java:96) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89) at com.youboy.shardSessionFilter.MemcachedSessionFilter.doFilter(MemcachedSessionFilter.java:48) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89) at com.youboy.shop.filter.RateFilter.doFilter(RateFilter.java:53) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89) at com.youboy.tracing.filter.TraceFilter.doFilter(TraceFilter.java:42) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89) at com.caucho.server.httpcache.ProxyCacheFilterChain.doRequestCacheable(ProxyCacheFilterChain.java:251) at com.caucho.server.httpcache.ProxyCacheFilterChain.doFilter(ProxyCacheFilterChain.java:192) at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:156) at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:95) at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:289) at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:838) at com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:1309) at com.caucho.network.listen.TcpSocketLink.handleRequest(TcpSocketLink.java:1265) at com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:1249) at com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:1157) at com.caucho.network.listen.TcpSocketLink.handleAcceptTaskImpl(TcpSocketLink.java:956) at com.caucho.network.listen.TcpSocketLink.handleAcceptTask(TcpSocketLink.java:908) at com.caucho.network.listen.ConnectionTask.runThread(ConnectionTask.java:114) at com.caucho.network.listen.ConnectionTask.run(ConnectionTask.java:93) at com.caucho.network.listen.SocketLinkThreadLauncher.handleTasks(SocketLinkThreadLauncher.java:169) at com.caucho.network.listen.TcpSocketResumeThread.run(TcpSocketResumeThread.java:62) at com.caucho.env.thread2.ResinThread2.runTasks(ResinThread2.java:173) at com.caucho.env.thread2.ResinThread2.run(ResinThread2.java:118)