Class ThymeleafView

Object
org.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.thymeleaf.spring6.view.AbstractThymeleafView
org.thymeleaf.spring6.view.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

public class ThymeleafView extends AbstractThymeleafView

Base implementation of the Spring WebMVC 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:
3.0.3
Author:
Daniel Fernández
  • Constructor Details

    • 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 Details

    • 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.
    • 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.
    • render

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

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