Reputation: 31
I have a basic table where some values are being provided by thymeleaf via th:text=
tags.
That all works fine until we added the dandelion.datatables.thymeleaf.dialect.DataTablesDialect as a second dialect to our template engine.
with the dataTables dialect present, I get the following exception at the first instance of th:text
org.thymeleaf.exceptions.TemplateProcessingException: Error processing template: dialect prefix "th" is set as non-lenient but attribute "th:text" has not been removed during process
This appears to be nearly the same issue listed here: Error parsing thymeleaf template but I am hopeful that there is a better solution than "don't use the dataTablesDialect"
Thanks
--------------- Update -----------------------------------------
My Java config:
@Bean
public ThymeleafViewResolver thymeleafViewResolver() {
ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
viewResolver.setTemplateEngine(templateEngine());
viewResolver.setViewNames(new String[]{"template*"});
viewResolver.setOrder(1);
return viewResolver;
}
@Bean
public ServletContextTemplateResolver templateResolver() {
ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver();
templateResolver.setPrefix("/WEB-INF/views/");
templateResolver.setSuffix(".html");
templateResolver.setTemplateMode("HTML5");
templateResolver.setCacheable(false);
return templateResolver;
}
@Bean
public SpringTemplateEngine templateEngine() {
SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.setTemplateResolver(templateResolver());
templateEngine.addDialect(dataTablesDialect());
return templateEngine;
}
@Bean
public DataTablesDialect dataTablesDialect() {
return new DataTablesDialect();
}
@Bean
public ContentNegotiatingViewResolver contentNegotiatingViewResolver() {
ContentNegotiatingViewResolver viewResolver = new ContentNegotiatingViewResolver();
List<ViewResolver> viewResolvers = new ArrayList<ViewResolver>();
viewResolvers.add(thymeleafViewResolver());
viewResolver.setViewResolvers(viewResolvers);
return viewResolver;
}
The interesting part of my template:
<table id="reviewtable" >
<tbody class="gridtable">
<tr>
<td >compare:</td>
<td th:text="${row.sys1Val}">111</td>
<td th:text="${row.sys2Val}">223</td>
</tr>
</tbody>
</table>
Upvotes: 0
Views: 769
Reputation: 4471
This is a bug which will fixed in Dandelion-Datatables 0.9.0.
Meanwhile, there are 2 solutions:
Upvotes: 1