PagesDialect for Thymeleaf - Quick start

Configuration for Maven + Spring users

  1. Add the dependency to your pom.xml

    <dependencies>
    ...
    <dependency>
    <groupId>net.sourceforge.pagesdialect</groupId>
    <artifactId>pagesdialect-core</artifactId>
    <version>2.0.0</version>
    </dependency>
    ...
    </dependencies>

    Note that 2.0.x versions are compatible with Thymeleaf 2.0.x versions, while 2.1.x versions are compatible with Thymeleaf 2.1.x versions.

  2. Add PagesDialect to your Thymeleaf configuration within the Spring configuration file

    <bean id="templateEngine" class="org.thymeleaf.spring3.SpringTemplateEngine">
    <property name="templateResolver" ref="templateResolver" />
    <property name="dialects">
    <set>
    <bean class="org.thymeleaf.spring3.dialect.SpringStandardDialect" />
    <bean class="net.sourceforge.pagesdialect.PagesDialect" />
    </set>
    </property>
    </bean>
  3. [Optional] If you don't use a Servlet 3.0+ capable container or you have the attribute metadata-complete="true" in your web-app element, add to your web.xml

    <filter>
    <filter-name>exportFilter</filter-name>
    <filter-class>net.sourceforge.pagesdialect.ExportFilter</filter-class>
    <init-param>
    <param-name>exportRequestParameterName</param-name>
    <param-value>export</param-value>
    </init-param>
    </filter>
    <filter-mapping>
    <filter-name>exportFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
  4. [Optional] If you want to use a SNAPSHOT version and you haven't got it, add Sonatype Snapshot repository to your pom.xml

    <repositories>
    ...
    <repository>
    <id>sonatype-snapshots</id>
    <name>Sonatype snapshots</name>
    <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
    </repository>
    ...
    </repositories>

Back