2021-08-17
This commit is contained in:
@@ -7,6 +7,8 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<p><span th:text="#{hello}"></span><span th:text="${person.name}">NAME</span></p>
|
<p><span th:text="#{hello}"></span><span th:text="${person.name}">NAME</span></p>
|
||||||
<p th:text="#{only}"></p>
|
<p><span th:text="#{only}">ONLY IN ROOT</span></p>
|
||||||
|
<p>with Text: <span th:text="${html}"></span></p>
|
||||||
|
<p>with UText: <span th:utext="${html}"></span></p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -20,8 +20,9 @@ class ThymeleafTest {
|
|||||||
@Test
|
@Test
|
||||||
void test() throws IOException {
|
void test() throws IOException {
|
||||||
Context context = new Context();
|
Context context = new Context();
|
||||||
///context.setLocale(Locale.ENGLISH);
|
//context.setLocale(Locale.ENGLISH);
|
||||||
context.setVariable("person", new Person("Charlie", 14));
|
context.setVariable("person", new Person("Charlie", 14));
|
||||||
|
context.setVariable("html", "<strong>Hahaha</strong>");
|
||||||
|
|
||||||
Thymeleaf thymeleaf = new Thymeleaf();
|
Thymeleaf thymeleaf = new Thymeleaf();
|
||||||
String out = thymeleaf.process("sample.html", context);
|
String out = thymeleaf.process("sample.html", context);
|
||||||
|
|||||||
Reference in New Issue
Block a user