Pregunta

I'm trying to use Thymeleaf integration with Apache Tiles 2.x. They have a guide how to make it work so I followed it, but now I'm stuck.

Basically this integration allows using both JSPs and Thymeleaf templates and according to the guide, you should be able to tell which to use by setting the type attribute in your title-definition files. Default option is Thymeleaf.

Because I am slowly migrating from JSP, the vast majority of the templates are JSPs, so I need to use this type attribute, but then I get an error that my title definition file is not valid:

org.apache.tiles.definition.DefinitionsFactoryException: XML error reading definitions.
at org.apache.tiles.definition.digester.DigesterDefinitionsReader.read(DigesterDefinitionsReader.java:332)
at org.apache.tiles.definition.dao.BaseLocaleUrlDefinitionDAO.loadDefinitionsFromURL(BaseLocaleUrlDefinitionDAO.java:276)
at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadDefinitionsFromURLs(CachingLocaleUrlDefinitionDAO.java:251)
at org.apache.tiles.definition.dao.ResolvingLocaleUrlDefinitionDAO.loadDefinitionsFromURLs(ResolvingLocaleUrlDefinitionDAO.java:65)
at org.apache.tiles.definition.dao.ResolvingLocaleUrlDefinitionDAO.loadParentDefinitions(ResolvingLocaleUrlDefinitionDAO.java:58)
at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadDefinitionsFromURLs(CachingLocaleUrlDefinitionDAO.java:239)
at org.apache.tiles.definition.dao.ResolvingLocaleUrlDefinitionDAO.loadDefinitionsFromURLs(ResolvingLocaleUrlDefinitionDAO.java:65)
...

This is my tiles definition file:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE tiles-definitions PUBLIC
       "-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN"
       "http://tiles.apache.org/dtds/tiles-config_2_1.dtd">

<tiles-definitions>
    <definition name="default" template="/WEB-INF/layouts/default.jspx" type="jsp">
    </definition>
</tiles-definitions>

If I remove DOCTYPE part, I got same error.

Any idea how to get it working?

¿Fue útil?

Solución

The type attribute only exists in <put-attribute/> elements. By contrast, <definition/> elements require your attribute to be called templateType.

Regards.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top