Generic Dialogue in thymeleaf

2

Good evening, friends,

Has anyone tried or ever done a generic dialogue on thymeleaf?

What I want is:

Instead of writing code to confirm the deletion of a data on the screen is something simple, I would like to make a generic, where I would just have the confirm or cancel button, and then just include it in my page.

    
asked by anonymous 02.04.2017 / 01:54

1 answer

1

You can use layout: decorator and layout: fragment so I understand you want the contents of the screens to be changed but without changing what's around the menus as examples.

In your "Main.html" screen you should put a layout: fragment as in the example:

 
<div layout:fragment="conteudo">
  <p>Conteúdo principal</p>
</div>

In this place will be injected the content that you put in the other pages. In the other pages you will use a decorator, in this case I called "Main" and implement the "Contents" of the layout: fragment, example:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:th="http://www.thymeleaf.org"
	xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
	layout:decorator="Principal">
<head>
</head>
<div layout:fragment="conteudo">
Pagina 1
</div>
</html>

You can look at the complete documentation at link

    
14.07.2017 / 21:21