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
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
-
Field Summary
Fields inherited from class org.thymeleaf.spring5.view.AbstractThymeleafView
DEFAULT_CONTENT_TYPE, DEFAULT_PRODUCE_PARTIAL_OUTPUT_WHILE_PROCESSING
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
logger
Fields inherited from interface org.springframework.web.servlet.View
PATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE
-
Constructor Summary
ConstructorDescriptionCreates a new instance ofThymeleafView
.ThymeleafView
(String templateName) Creates a new instance ofThymeleafView
, specifying the template name. -
Method Summary
Modifier and TypeMethodDescriptionReturns the markup selector defining the part of the template that should be processed.void
render
(Map<String, ?> model, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) protected void
renderFragment
(Set<String> markupSelectorsToRender, Map<String, ?> model, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) void
setMarkupSelector
(String markupSelector) Sets the markup selector defining the part of the template that should be processed.Methods inherited from class org.thymeleaf.spring5.view.AbstractThymeleafView
addRequestContextAsVariable, addStaticVariable, getBeanName, getCharacterEncoding, getContentType, getForceContentType, getLocale, getProducePartialOutputWhileProcessing, getStaticVariables, getTemplateEngine, getTemplateName, isContentTypeSet, isForceContentTypeSet, isProducePartialOutputWhileProcessingSet, setBeanName, setCharacterEncoding, setContentType, setForceContentType, setLocale, setProducePartialOutputWhileProcessing, setStaticVariables, setTemplateEngine, setTemplateName
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, obtainApplicationContext, requiredContextClass, setApplicationContext
-
Constructor Details
-
ThymeleafView
public ThymeleafView()Creates a new instance of
ThymeleafView
. -
ThymeleafView
Creates a new instance of
ThymeleafView
, specifying the template name.- Parameters:
templateName
- the template name.
-
-
Method Details
-
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
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, 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
-