admin管理员组

文章数量:1356453

this is my common file base.html

I created this whole page as a fragment to us on other pages and also want to pass contents to this fragment but it is not working on my about page

base.html

'''
<!DOCTYPE html>
<html lang="en"
th-fragment="parent(content, title)"
xmlns:th=";
>
<head>
   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <!-- This is the main tailwindcss file output.css -->
   <link rel="stylesheet" data-th-href="@{'/css/output.css'}">

   <!-- flowbite css CDN link for in-built components of tailwindcss -->
   <link href="/[email protected]/dist/flowbite.min.css" 
   rel="stylesheet" />
   <title th-replace="${title}">Document</title>
 </head>
 <body>
    <ul>
    <li>
        <a data-th-href="@{'/home'}">Home</a>
    </li>
    <li>
        <a data-th-href="@{'/about'}">About</a>
    </li>
    <li>
        <a data-th-href="@{'/services'}">Services</a>
    </li>
    <!-- <li>
        <a data-th-href="@{'/home'}">Home</a>
    </li> -->
 </ul>

<section th-insert="${content}"></section>

<!-- flowbite javascript CDN link for in-built components of tailwindcss -->
<script src="/[email protected]/dist/flowbite.min.js"> 
</script>
</body>
</html>
'''

this is the about page which uses the base.html page and pass the arguments

i have added the thymeleaf dependency.

about.html

'''
<!DOCTYPE html>
<html lang="en" 
   xmlns:th=";
   th-replace="~{base::parent(~{::#content}, ~{::title})}">
   <head>
        <title>About</title>
   </head>
   <body>
       <section id="content">
         <h1>Welcome to About Page</h1>
       </section>

       <div th-replace="~{base2::resolved}">Hi , this is about page</div>

   </body>
</html>
'''

本文标签: htmlHow to resolve thymeleaf fragment(threplace) is not working with spring bootStack Overflow