Class StringTemplate


  • public class StringTemplate
    extends Object
    Provides a StringTemplate which utilizes the Velocity Engine.
    • Constructor Detail

      • StringTemplate

        public StringTemplate​(String content)
        Create a template with the given content.
        Parameters:
        content - the template content
      • StringTemplate

        public StringTemplate​(String content,
                              ServletContext servletContext)
        Create a template with the given content.
        Parameters:
        content - the template content
        servletContext - the applications servlet context
    • Method Detail

      • merge

        public String merge​(Map model)
        Merge the given model data with the template.
        Parameters:
        model - the model data to merge
        Returns:
        the rendered template merged with the model
      • merge

        public String merge​(String key,
                            Object value)
        Merge the given model key name and value with the template.
        Parameters:
        key - the model key name
        value - the model value
        Returns:
        the rendered template merged with the model
      • getTemplateEngine

        protected org.apache.velocity.app.VelocityEngine getTemplateEngine()