2021-08-17

This commit is contained in:
2021-08-17 21:49:24 +09:00
parent 7f018b0136
commit 1a7710b100
2 changed files with 5 additions and 2 deletions

View File

@@ -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>

View File

@@ -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);