I have 2 HTML files, suppose one.html and two.html. In one.html I want to include two.html.
In JSF I can do it like that:
It means that inside one.xhtml file, I can include two.xhtml.
How can we do it in *.html file? in thymeleaf
you can do it easily. could you share your header.html
file?
or, let me show a bit like I do for my projects
in header.html
put in side the <body>
a code:
<div th:fragment="client_header">
<p>This is for client</p>
</div>
<div th:fragment="admin_header">
<p>This is for admin</p>
</div>
and let's say you want to add client_header
into the index.html
. Do follow these in your index.html
page (inside <body>
)
<div th:replace="includes/header :: client_header">
</div>
note: includes/header
before ::
refers the html path (excludes .html
) and client_header
after ::
refers the part in header.html
you want to insert.
I hope you understand everything that I have explain here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With