Announcement Announcement Module
Collapse
No announcement yet.
Spring MVC 3.1 + Tiles 2.2: Error when using wildcard Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring MVC 3.1 + Tiles 2.2: Error when using wildcard

    Hello everyone,

    I have a basic project and want to use Tiles. The idea is to use one main template for multiple pages.
    I don't want to add multiple definitions so I'm trying to use wildcards.
    Below are my files where I have Tiles configured.
    When I have the configuration files of Tiles without wildcards it works well, as soon as I use wildcards it fails.
    All configuration files and error messages are show below.

    And yes the files are in the right place



    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans:beans xmlns="http://www.springframework.org/schema/mvc"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:beans="http://www.springframework.org/schema/beans"
    	xmlns:context="http://www.springframework.org/schema/context"
    	xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
    		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
    
    	<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
    	
    	<!-- Enables the Spring MVC @Controller programming model -->
    	<annotation-driven />
    
    	<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
    	<resources mapping="/resources/**" location="/resources/" />
    	
    	<beans:bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
    		<beans:property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView" />
    	</beans:bean>
    	
    	<beans:bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
    		<beans:property name="definitions">
    			<beans:list>
    				<beans:value>/WEB-INF/defs/tiles.xml</beans:value>
    			</beans:list>
    		</beans:property>
    	</beans:bean>
    	
    </beans:beans>
    Code:
    <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title><tiles:insertAttribute name="title" /></title>
    </head>
    <body>
    <tiles:insertAttribute name="header" />
    <hr />
    <tiles:insertAttribute name="body" />
    
    </body>
    </html>
    Code:
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE tiles-definitions PUBLIC
           "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
           "http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
    <tiles-definitions>
        <definition name="base.definition"
            template="/WEB-INF/views/layouts/standard.jsp">
            <put-attribute name="title" value="Application Title" />
            <put-attribute name="header" value="/WEB-INF/views/header.jsp" />
            <put-attribute name="body" value="" />
        </definition>
     
        <definition name="home" extends="base.definition">
            <put-attribute name="body" value="/WEB-INF/views/home.jsp" />
        </definition>
     
    </tiles-definitions>
    This works!


    Code:
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE tiles-definitions PUBLIC
           "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
           "http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
    <tiles-definitions>
        <definition name="base.definition"
            template="/WEB-INF/views/layouts/standard.jsp">
            <put-attribute name="title" value="Application Title" />
            <put-attribute name="header" value="/WEB-INF/views/header.jsp" />
            <put-attribute name="body" value="" />
        </definition>
     
        <definition name="**" extends="base.definition">
            <put-attribute name="body" value="/WEB-INF/views/{1}.jsp" />
        </definition>
     
    </tiles-definitions>
    If I configure this way the application shows the following error message:
    org.apache.tiles.util.TilesIOException: JSPException including path '/WEB-INF/views/layouts/standard.jsp'.
Working...
X