title: Freemarker: Unexpected directive, "</#if>"
body: <p>I've got some code in my login template that shows error on wrong credentials written in freemarker. Everything looks just how it should, syntax is correct, but sparkjava throws ParseException</p>
  
  <pre><code>freemarker.core.ParseException: Syntax error in template "freemarker/admin_login.ftl" in line 40, column 9:
  Unexpected directive, "&lt;/#if&gt;". Check if you have a valid #if-#elseif-#else structure.
  at freemarker.core.FMParser.generateParseException(FMParser.java:5251)
  at freemarker.core.FMParser.jj_consume_token(FMParser.java:5122)
  at freemarker.core.FMParser.Root(FMParser.java:3433)
  at freemarker.template.Template.&lt;init&gt;(Template.java:208)
  at freemarker.cache.TemplateCache.loadTemplate(TemplateCache.java:495)
  at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:409)
  at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:261)
  at freemarker.template.Configuration.getTemplate(Configuration.java:1786)
  at freemarker.template.Configuration.getTemplate(Configuration.java:1646)
  at spark.template.freemarker.FreeMarkerEngine.render(FreeMarkerEngine.java:69)
  at pl.bluedotdevs.adminpanel.utils.ViewUtil.render(ViewUtil.java:22)
  at pl.bluedotdevs.adminpanel.login.LoginController.lambda$static$0(LoginController.java:21)
  at spark.RouteImpl$1.handle(RouteImpl.java:61)
  at spark.http.matching.Routes.execute(Routes.java:61)
  at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:128)
  at spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50)
  at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189)
  at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
  at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119)
  at org.eclipse.jetty.server.Server.handle(Server.java:517)
  at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:302)
  at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242)
  at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:245)
  at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
  at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75)
  at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213)
  at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147)
  at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
  at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
  at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>&lt;#if($authenticationFailed)&gt;
          &lt;div class="alert alert-danger" role="alert"&gt;Niepoprawny email lub hasło&lt;/div&gt;
      &lt;#elseif($authenticationSucceeded)&gt;
          &lt;div class="alert alert-success" role="alert"&gt;Zalogowano pomyślnie&lt;/div&gt;--&gt;
      &lt;#elseif($loggedOut)&gt;
          &lt;div class="alert alert-success" role="alert"&gt;Wylogowano pomyślnie&lt;/div&gt;--&gt;
      &lt;/#if&gt;
  </code></pre>
  
  <p>I really don't know what is wrong. I have looked in documentation and I think my elseif syntax is good. Could you help me?</p>