Class SpringStandardDialect
- All Implemented Interfaces:
IDialect,IExecutionAttributeDialect,IExpressionObjectDialect,IProcessorDialect
SpringStandard Dialect. This is the class containing the implementation of Thymeleaf Standard Dialect, including all
th:* processors, expression objects, etc. for Spring-enabled environments.
This dialect is valid both for Spring WebMVC and Spring WebFlux environments.
Note this dialect uses SpringEL as an expression language and adds some Spring-specific
features on top of StandardDialect, like th:field or Spring-related expression objects.
The usual and recommended way of using this dialect is by instancing SpringTemplateEngine
instead of TemplateEngine. The former will automatically add this dialect and perform
some specific configuration like e.g. Spring-integrated message resolution.
Note a class with this name existed since 1.0, but it was completely reimplemented in Thymeleaf 3.0
- Since:
- 3.0.3
- Author:
- Daniel Fernández
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanstatic final booleanstatic final Stringstatic final Stringstatic final intFields inherited from class org.thymeleaf.standard.StandardDialect
conversionService, cssSerializer, expressionObjectFactory, expressionParser, javaScriptSerializer, variableExpressionEvaluator -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Set<IProcessor>createSpringStandardProcessorsSet(String dialectPrefix) Create a the set of SpringStandard processors, all of them freshly instanced.static Set<IProcessor>createSpringStandardProcessorsSet(String dialectPrefix, boolean renderHiddenMarkersBeforeCheckboxes) Create a the set of SpringStandard processors, all of them freshly instanced.booleanReturns whether the SpringEL compiler should be enabled in SpringEL expressions or not.getProcessors(String dialectPrefix) booleanReturns whether the<input type="hidden" ...>marker tags rendered to signal the presence of checkboxes in forms when unchecked should be rendered before the checkbox tag itself, or after (default).voidsetEnableSpringELCompiler(boolean enableSpringELCompiler) Sets whether the SpringEL compiler should be enabled in SpringEL expressions or not.voidsetRenderHiddenMarkersBeforeCheckboxes(boolean renderHiddenMarkersBeforeCheckboxes) Sets whether the<input type="hidden" ...>marker tags rendered to signal the presence of checkboxes in forms when unchecked should be rendered before the checkbox tag itself, or after (default).voidsetVariableExpressionEvaluator(IStandardVariableExpressionEvaluator variableExpressionEvaluator) Methods inherited from class org.thymeleaf.standard.StandardDialect
createStandardProcessorsSet, getCSSSerializer, getExpressionParser, getJavaScriptSerializer, setConversionService, setCSSSerializer, setExpressionParser, setJavaScriptSerializerMethods inherited from class org.thymeleaf.dialect.AbstractProcessorDialect
getDialectProcessorPrecedence, getPrefixMethods inherited from class org.thymeleaf.dialect.AbstractDialect
getName
-
Field Details
-
NAME
- See Also:
-
PREFIX
- See Also:
-
PROCESSOR_PRECEDENCE
public static final int PROCESSOR_PRECEDENCE- See Also:
-
DEFAULT_ENABLE_SPRING_EL_COMPILER
public static final boolean DEFAULT_ENABLE_SPRING_EL_COMPILER- See Also:
-
DEFAULT_RENDER_HIDDEN_MARKERS_BEFORE_CHECKBOXES
public static final boolean DEFAULT_RENDER_HIDDEN_MARKERS_BEFORE_CHECKBOXES- See Also:
-
-
Constructor Details
-
SpringStandardDialect
public SpringStandardDialect()
-
-
Method Details
-
getEnableSpringELCompiler
public boolean getEnableSpringELCompiler()Returns whether the SpringEL compiler should be enabled in SpringEL expressions or not.
Expression compilation can significantly improve the performance of Spring EL expressions, but might not be adequate for every environment. Read the official Spring documentation for more detail.
Also note that although Spring includes a SpEL compiler since Spring 4.1, most expressions in Thymeleaf templates will only be able to properly benefit from this compilation step when at least Spring Framework version 4.2.4 is used.
This flag is set to
falseby default.- Returns:
trueif SpEL expressions should be compiled if possible,falseif not.
-
setEnableSpringELCompiler
public void setEnableSpringELCompiler(boolean enableSpringELCompiler) Sets whether the SpringEL compiler should be enabled in SpringEL expressions or not.
Expression compilation can significantly improve the performance of Spring EL expressions, but might not be adequate for every environment. Read the official Spring documentation for more detail.
Also note that although Spring includes a SpEL compiler since Spring 4.1, most expressions in Thymeleaf templates will only be able to properly benefit from this compilation step when at least Spring Framework version 4.2.4 is used.
This flag is set to
falseby default.- Parameters:
enableSpringELCompiler-trueif SpEL expressions should be compiled if possible,falseif not.
-
getRenderHiddenMarkersBeforeCheckboxes
public boolean getRenderHiddenMarkersBeforeCheckboxes()Returns whether the
<input type="hidden" ...>marker tags rendered to signal the presence of checkboxes in forms when unchecked should be rendered before the checkbox tag itself, or after (default).A number of CSS frameworks and style guides assume that the
<label ...>for a checkbox will appear in markup just after the<input type="checkbox" ...>tag itself, and so the default behaviour of rendering an<input type="hidden" ...>after the checkbox can lead to bad application of styles. By tuning this flag, developers can modify this behaviour and make the hidden tag appear before the checkbox (and thus allow the lable to truly appear right after the checkbox).Note this hidden field is introduced in order to signal the existence of the field in the form being sent, even if the checkbox is unchecked (no URL parameter is added for unchecked check boxes).
This flag is set to
falseby default.- Returns:
trueif hidden markers should be rendered before the checkboxes,falseif not.- Since:
- 3.0.10
-
setRenderHiddenMarkersBeforeCheckboxes
public void setRenderHiddenMarkersBeforeCheckboxes(boolean renderHiddenMarkersBeforeCheckboxes) Sets whether the
<input type="hidden" ...>marker tags rendered to signal the presence of checkboxes in forms when unchecked should be rendered before the checkbox tag itself, or after (default).A number of CSS frameworks and style guides assume that the
<label ...>for a checkbox will appear in markup just after the<input type="checkbox" ...>tag itself, and so the default behaviour of rendering an<input type="hidden" ...>after the checkbox can lead to bad application of styles. By tuning this flag, developers can modify this behaviour and make the hidden tag appear before the checkbox (and thus allow the lable to truly appear right after the checkbox).Note this hidden field is introduced in order to signal the existence of the field in the form being sent, even if the checkbox is unchecked (no URL parameter is added for unchecked check boxes).
This flag is set to
falseby default.- Parameters:
renderHiddenMarkersBeforeCheckboxes-trueif hidden markers should be rendered before the checkboxes,falseif not.- Since:
- 3.0.10
-
getVariableExpressionEvaluator
- Overrides:
getVariableExpressionEvaluatorin classStandardDialect
-
setVariableExpressionEvaluator
public void setVariableExpressionEvaluator(IStandardVariableExpressionEvaluator variableExpressionEvaluator) - Overrides:
setVariableExpressionEvaluatorin classStandardDialect
-
getConversionService
- Overrides:
getConversionServicein classStandardDialect
-
getExpressionObjectFactory
- Specified by:
getExpressionObjectFactoryin interfaceIExpressionObjectDialect- Overrides:
getExpressionObjectFactoryin classStandardDialect
-
getProcessors
- Specified by:
getProcessorsin interfaceIProcessorDialect- Overrides:
getProcessorsin classStandardDialect
-
getExecutionAttributes
- Specified by:
getExecutionAttributesin interfaceIExecutionAttributeDialect- Overrides:
getExecutionAttributesin classStandardDialect
-
createSpringStandardProcessorsSet
Create a the set of SpringStandard processors, all of them freshly instanced.
- Parameters:
dialectPrefix- the prefix established for the Standard Dialect, needed for initialization- Returns:
- the set of SpringStandard processors.
-
createSpringStandardProcessorsSet
public static Set<IProcessor> createSpringStandardProcessorsSet(String dialectPrefix, boolean renderHiddenMarkersBeforeCheckboxes) Create a the set of SpringStandard processors, all of them freshly instanced.
- Parameters:
dialectPrefix- the prefix established for the Standard Dialect, needed for initializationrenderHiddenMarkersBeforeCheckboxes-trueif hidden markers should be rendered before the checkboxes,falseif not.- Returns:
- the set of SpringStandard processors.
- Since:
- 3.0.10
-