public final class StandardSwitchAttrProcessor extends AbstractStandardSwitchStructureAttrProcessor
<div th:switch="${user.role}">
<p th:case="'admin'">User is an administrator</p>
<p th:case="#{roles.manager}">User is a manager</p>
</div>
Note that as soon as one th:case attribute is evaluated as true, every other th:case attribute in the same switch context is evaluated as false.
The default option is specified as th:case="*"
AbstractStandardSwitchStructureAttrProcessor.SwitchStructure| Modifier and Type | Field and Description |
|---|---|
static String |
ATTR_NAME |
static int |
ATTR_PRECEDENCE |
SWITCH_VARIABLE_NAME| Constructor and Description |
|---|
StandardSwitchAttrProcessor() |
| Modifier and Type | Method and Description |
|---|---|
int |
getPrecedence() |
getNewLocalVariablesprocessAttributedoProcess, getMatchercompareTo, getMessage, getMessageForProcessor, getMessageForTemplate, processpublic static final int ATTR_PRECEDENCE
public static final String ATTR_NAME
public int getPrecedence()
getPrecedence in class AbstractProcessorCopyright © 2017 The THYMELEAF team. All rights reserved.