I created a custom tag library with Spring MVC, JSP and Tyles, so I have several .tagx files. With a new project, I decided to try Spring Boot and Thymelaf, but I would like to keep my own library ...
So, if you can create your own tag library using thymleaf? Or if I can somehow import my own tag library?
EDIT
I will add some code to be more clear. The following tags used are my customized tags. So I turned on JSP with xmlns:form="urn:jsptagdir:/WEB-INF/tags/form"
<form:create id="fu_utente" modelAttribute="utente" path="/utente" > <div class="row"> <div class="col-md-12 text-center"> <h1 class="fa fa-user-plus" style="color:green;"><b>  Stai creando un nuovo utente di tipo: <var class="varFont"> ${utente.ruolo}</var></b></h1> </div> </div> <div class="row"> <div class="col-xs-12 col-sm-12 col-md-4 col-md-offset-2"> <field:input field="nome" id="c_utente_nome" required="true"/> </div> <div class="col-xs-12 col-sm-12 col-md-4"> <field:input field="userName" id="c_utente_username" min="5" max="15" required="true"/> </div> <div class="col-xs-12 col-sm-12 col-md-8 col-md-offset-2"> <field:input field="email" id="c_Utente_email" required="true" validationRegex="^[a-z0-9_\+-]+(\.[a-z0-9_\+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([az]{2,4})$"/> </div> <div class="col-xs-12 col-sm-12 col-md-4 col-md-offset-2"> <field:input field="nuovaPassword" id="c_utente_password" min="6" max="15" required="true" type="password"/> </div> <div class="col-xs-12 col-sm-12 col-md-4"> <field:input field="confermaNuovaPassword" id="c_utente_confirmPassword" required="true" type="password"/> </div> </div> </div> </form>
The result of this page is a standard HTML page with a form, fields and captions inside and a submit button.
This way I can quickly write many html codes. For example, instead of writing <label>..... </label><input....../> for each field, I can only write <field:input......> , using also internationalization.
I would like to have (and, I think, it can be very useful) the same thing in Thimeleaf.
Otherwise, if you know a method using Thymeleaf to avoid saving codes and time, please tell me.
spring spring-boot taglib thymeleaf
Teo
source share