I don't know how to wrote this kind of insruction using Thyeleaf. I've got my view made with html.
<#if updateClient??>
<h2>Modifica del prodotto - ${updateClient.nome}</h2>
<div style="margin: 20px;">
<form method="POST" action="update" id="updateClient">
<input type="hidden" name="id" value="${updateClient.id}"/>
<div>
<label for="name">Name</label>
<input type="text" name="nome" id="nome" value="${updateClient.nome}" />
</div>
<div>
<input type="submit" name="invia" value="Update" />
</div>
</form>
</div>
<#else>
<h2>New Client</h2>
<div style="margin: 20px;">
<form method="POST" action="add" id="newDataClient">
<div>
<label for="nome">Nome</label>
<input type="text" name="nome" id="nome" value="" />
</div>
<div>
<input type="submit" name="invia" value="Add" />
</div>
</form>
</div>
</#if>
This was written using FreeMarker, but I need to use Thymeleaf. I know simple Thymeleaf instructions, but I don't know how to do this. I read Thymeleaf instructions, and I find how to iterate a list of variables, but not how to create this structure using if and else. And if it's possible create something like this.
Aucun commentaire:
Enregistrer un commentaire