小编Udi*_*ngh的帖子

已弃用的未包装片段表达式

您好,当使用 thymeleaf 3.1 和 spring6 单击注册按钮时,我收到以下错误,有人可以帮助我解决如何在新版本中编写给定语法的问题吗?

基础::布局(~{::节})

已弃用的未包装片段表达式“base::layout(~{::section})”在模板register.html第2行第53列中找到。请改用片段表达式的完整语法(“~{base::layout(~ {::部分})}”)。旧的、未包装的片段表达式语法将在 Thymeleaf 的未来版本中删除。

下面是我的 register.html 文件

<!DOCTYPE html>
<html  lang="en" xmlns:th="http://www.thymeleaf.org" 
       th:replace="base::layout(~{::section})">
<head>
    <meta charset="ISO-8859-1">
    <title>Insert title</title>
</head>
<body>
    <section>
        <div class="container p-3" >
            <div class="row">
                <div class="col-md-6 offset-md-3">
                    <div class="card">
                        <div class="card-header text-center fs-4">Register Page</div>
                        <th:block th:if="${session.msg}">
                            <p class="text-center fs-3">[[${session.msg}]]</p>
                            <th:block th:text="${#session.removeAttribute('msg')}" </th:block>
                            </th:block>
                        <div class="card-body">
                            <form action="createUser" method="post">
                                <div class="mb-3">
                                    <label>Enter First Name</lable>
                                        <input type="text" name="firstname" class="form-control">
                                </div>
                                <div class="mb-3">
                                    <label>Enter Middle Name</lable>
                                        <input type="text" name="middlename" class="form-control">
                                </div>
                                <div class="mb-3"> …
Run Code Online (Sandbox Code Playgroud)

java spring spring-thymeleaf

2
推荐指数
1
解决办法
6907
查看次数

标签 统计

java ×1

spring ×1

spring-thymeleaf ×1