XML namespace for custom thymeleaf tags



I add some custom thymeleaf's dialects and processors to my spring-boot project, in the packages: org.store.custom.thymeleaf.dialect and org.store.custom.thymeleaf.processor. In my html page, I configure the namespace in this way:



<html
xmlns="http://ift.tt/lH0Osb"
xmlns:th="http://ift.tt/wfNV60"
xmlns:sec="http://ift.tt/1vQCupq"
xmlns:form="http://form"
xmlns:field="http://field">


which it's not working. What should be the right value for xmlns:form and xmlns:field to make the tags based on them work?


UPDATE


the thymeleaf configuration is this:



@Configuration
public class Thymeleaf {
@Bean
public SpringTemplateEngine templateEngine() {
SpringTemplateEngine engine = new SpringTemplateEngine();

final Set<IDialect> dialects = new HashSet<IDialect>();
dialects.add( new SpringSecurityDialect() );
dialects.add( new FormDialect() );
dialects.add( new FieldDialect() );
engine.setDialects( dialects );

return engine;
}
}


the full code for the page is that:



<!DOCTYPE html>
<html
xmlns="http://ift.tt/lH0Osb"
xmlns:th="http://ift.tt/wfNV60"
xmlns:sec="http://ift.tt/1vQCupq"
xmlns:form="http://form"
xmlns:field="http://field">
<head>
<title>Cadastro</title>
</head>
<body>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Cadastrar <span th:text="${command.getClass().getSimpleName()}"/></h3>
</div>
<div class="panel-body">
<form:form th:attr="command=${command.getClass().getSimpleName()}">
<div th:each="item : ${command.getClass().getDeclaredFields()}">
<div th:each="item2 : ${item.getDeclaredAnnotations()}">
<div th:switch="${item2.annotationType().getSimpleName()}">
<div th:case="'Checkbox'"><field:checkbox th:attr="index=${itemStat.index}"/></div>
<div th:case="'DataList'"><field:datalist th:attr="index=${itemStat.index}"/></div>
<div th:case="'Input'"><field:input th:attr="index=${itemStat.index}"/></div>
<div th:case="'Radiobutton'"><field:radio th:attr="index=${itemStat.index}"/></div>
<div th:case="'Select'"><field:select th:attr="index=${itemStat.index}"/></div>
<div th:case="'Textarea'"><field:textarea th:attr="index=${itemStat.index}"/></div>
</div>
</div>
</div>
</form:form>
</div>
</div>
<script src="js/form_submit.js"></script>
<script src="js/form_valida.js"></script>
</body>
</html>

No comments:

Post a Comment