title: Freemarker WebappTemplateLoader in FreemarkerConfigurer
body: <p>Anyone has an example on how to use Freemarker WebappTemplateLoader in FreemarkerConfigurer?</p>
  
  <p>I am using Freemarker with Spring MVC and extending the FreeMarkerConfigurer to add various template loaders and I would also like to add a web app loader to load templates in web app context. But I do not know how to get the servletcontext parameter for its constructor.</p>
  
  <pre><code>public class DesktopFreeMarkerConfigurer extends FreeMarkerConfigurer{  
  
  @Override
  protected void postProcessConfiguration(Configuration config){
      [...]
          /* Get templates from the webapp/servlet context */
      WebappTemplateLoader watl = new WebappTemplateLoader(&lt;servletContext&gt;, "default/ftl/");
      [...]
      }
  }
  </code></pre>
  
  <p>I would like to add webapp/default/ftl to template loading path, but as it may be dynamic/configurable, I cannot hardcode it in the xml files.</p>
  
  <p>Any suggestions would be greatly appreciated.</p>
  
  <p>Thank you
  Carmen</p>