Hi,
I tried the example from tutorials. But it didnt work.

Here is my web.xml
...

<servlet-name>tiles</servlet-name>
      <servlet-class>org.apache.tiles.web.startup.TilesServlet
</servlet-class>
        <init-param>
            <param-name>
org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
            <param-value>/WEB-INF/tiles-defs.xml
,/org/apache/tiles/classpath-defs.xml</param-value>
        </init-param>
        <load-on-startup>2</load-on-startup>
    </servlet>

    <filter>
        <filter-name>Tiles Filter</filter-name>
        <filter-class>
            org.apache.tiles.web.startup.TilesFilter
        </filter-class>
        <init-param>
            <param-name>
org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
            </param-name>
            <param-value>
                /WEB-INF/tiles-defs.xml,/org/apache/tiles/classpath-defs.xml
            </param-value>
        </init-param>
    </filter>


    <filter-mapping>
        <filter-name>Tiles Filter</filter-name>
        <url-pattern>*</url-pattern>
   <!-- <url-pattern>/*</url-pattern>
------------------------------------line 1------------  -->
        <!-- <servlet-name>tiles</servlet-name>
------------------------------------line 2------------  -->
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping

    <context-param>
        <param-name>
            org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
        </param-name>
        <param-value>
            /WEB-INF/tiles-defs.xml,/org/apache/tiles/classpath-defs.xml
        </param-value>
    </context-param>

    <listener>
        <listener-class>
            org.apache.tiles.web.startup.TilesListener
        </listener-class>
    </listener>
...
...

I created tiles-defs.xml exactly same with tutorial.

...
<definition name="myapp.homepage" template="/layouts/classic.jsp">
...

And my jsp file,

...
<tiles:insertDefinition name="myapp.homepage" flush="false"/>
<!--<tiles:insertDefinition name="myapp.homepage"/>
-----------------------------line 3--------------  -->
...

This configuration and code throws java.lang.IllegalArgumentException:
Filter mapping must specify either a <url-pattern> or a <servlet-name>

I think configuration given in the tutorial is wrong, filter mapping's
url-pattern cannot be *, it can be /* (line 1).
When I change it to /* , this time
org.apache.tiles.definition.NoSuchDefinitionException: myapp.homepage is
thrown.

I also tried writing <servlet-name> attribute of filtermapping(line 2),
again the same exception is thrown.

line 3 is also tried, same exception again...

So, what do you think the problem is?
I use JSF 1.2, MyFaces Tomahawk 1.1.6, RichFaces 3.0.1, Tiles 2.0.4 on
Tomcat 6.0 server. But the problem is not caused by these, everything was
working fine before Tiles.

Any suggestions???

Reply via email to