gene b.
gene b.

Reputation: 11974

Apache Tiles 3.0 - Locally Save and Reference DTD

We're using Apache Tiles 3.0.

In our Apache Tiles-Def file, we occasionally have problems with this DTD reference, maybe because the site is unreliable. There are I/O errors "Reading Definitions" occasionally:

<!DOCTYPE tiles-definitions PUBLIC  "-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"        
    "http://tiles.apache.org/dtds/tiles-config_3_0.dtd">

The idea came up to save the DTD in the project. We dropped the DTD into /WEB-INF/classes, but it can't be found:

1) just "tiles-config_3_0.dtd":

Error: C:\Eclipse\LunaSR2\tiles-config_3_0.dtd not found

2) "/WEB-INF/classes/tiles-config_3_0.dtd":

java.io.FileNotFoundException: \WEB-INF\classes\tiles-config_3_0.dtd (The system cannot find the path specified)

Upvotes: 3

Views: 1463

Answers (1)

Lova Chittumuri
Lova Chittumuri

Reputation: 3303

1 ) In WEB-INF folder need to place the tiles-config_3_0.dtd

WEB-INF\tiles-config_3_0.dtd

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

2 ) Add the below mentioned dependencies in pom.xml

        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-core</artifactId>  
            <version>3.0.8</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-api</artifactId> 
            <version>3.0.8</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-servlet</artifactId> 
            <version>3.0.8</version>
        </dependency>
        
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-template</artifactId>  
            <version>3.0.8</version>
        </dependency>
        
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-el</artifactId> 
            <version>3.0.8</version>
        </dependency>
        </dependency> 
            <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-master</artifactId>
            <version>6</version> or 
            <version>7</version>
        </dependency>

3 ) Provide the concern classes in Dispatch-servlet.xml

<bean id="viewResolver"
    class="org.springframework.web.servlet.view.UrlBasedViewResolver">
    <property name="viewClass">
        <value> org.springframework.web.servlet.view.tiles3.TilesView</value>
    </property>
</bean>

<bean id="tilesConfigurerId"
    class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
    <property name="definitions">
        <list>
            <value>/WEB-INF/tiles-config_3_0.dtd</value>
        </list>
    </property>
</bean> 

Upvotes: 0

Related Questions