Class TemplateManager

java.lang.Object
org.javalite.activeweb.TemplateManager
Direct Known Subclasses:
FreeMarkerTemplateManager

public abstract class TemplateManager extends Object
Author:
Igor Polevoy
  • Constructor Details

    • TemplateManager

      public TemplateManager()
  • Method Details

    • merge

      public abstract void merge(Map<String,​Object> values, String templateName, String layout, String format, Writer writer, boolean customRoute)
      Merges values with templates and writes a merged template to the writer.
      Parameters:
      values - values to be merged.
      templateName - name of template in format: dir/template without file extension. This is to support multiple template technologies in the future.
      writer - Writer to write results to.
      customRoute - true if the route is custom. In this case, the template manager will not try to guess a template name based on a format
      layout - name of layout, null if no layout is needed.
    • merge

      public abstract void merge(Map<String,​Object> values, String template, Writer writer, boolean customRoute)
      Same as merge(java.util.Map, String, String, String, java.io.Writer, boolean customRoute), but uses default layout and default format (html).
    • setServletContext

      public abstract void setServletContext(javax.servlet.ServletContext ctx)
      A template manager might need a context to be able to load templates from it.
      Parameters:
      ctx - servlet context
    • setTemplateLocation

      public abstract void setTemplateLocation(String templateLocation)
      Parameters:
      templateLocation - this can be absolute or relative.
    • sessionId

      protected String sessionId()
      Session ID from underlying session, or null if session does not exist.