Class ThymeleafView

  • All Implemented Interfaces:
    org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware, org.springframework.web.servlet.View
    Direct Known Subclasses:
    AjaxThymeleafView, AjaxThymeleafView

    public class ThymeleafView
    extends AbstractThymeleafView

    Base implementation of the Spring MVC View interface.

    Views represent a template being executed, after being resolved (and instantiated) by a ViewResolver.

    This is the default view implementation resolved by ThymeleafViewResolver.

    Since:
    1.0
    Author:
    Daniel Fernández
    • Constructor Detail

      • ThymeleafView

        public ThymeleafView()

        Creates a new instance of ThymeleafView.

      • ThymeleafView

        public ThymeleafView​(String templateName)

        Creates a new instance of ThymeleafView, specifying the template name.

        Parameters:
        templateName - the template name.
    • Method Detail

      • getMarkupSelector

        public String getMarkupSelector()

        Returns the markup selector defining the part of the template that should be processed.

        This selector will be used for selecting the section of the template that should be processed, discarding the rest of the template. If null, the whole template will be processed.

        Subclasses of ThymeleafView might choose not to honor this parameter, disallowing the processing of template fragments.

        Returns:
        the markup selector currently set, or null of no fragment has been specified yet.
        Since:
        3.0.0
      • setMarkupSelector

        public void setMarkupSelector​(String markupSelector)

        Sets the markup selector defining the part of the template that should be processed.

        This selector will be used for selecting the section of the template that should be processed, discarding the rest of the template. If null, the whole template will be processed.

        Subclasses of ThymeleafView might choose not to honor this parameter, disallowing the processing of template fragments.

        Parameters:
        markupSelector - the markup selector to be set.
        Since:
        3.0.0
      • render

        public void render​(Map<String,​?> model,
                           javax.servlet.http.HttpServletRequest request,
                           javax.servlet.http.HttpServletResponse response)
                    throws Exception
        Throws:
        Exception
      • renderFragment

        protected void renderFragment​(Set<String> markupSelectorsToRender,
                                      Map<String,​?> model,
                                      javax.servlet.http.HttpServletRequest request,
                                      javax.servlet.http.HttpServletResponse response)
                               throws Exception
        Throws:
        Exception