I'm new to Tiles and trying to get Tiles3 working with Spring MVC 3.2.4. I thought I had everything setup/configured correctly, but I am not getting anything displayed at all. I've tried to enable DEBUG logging for org.apache.tiles, but nothing is showing up in the logs at all for tiles.
I am quite confused. I presume that there must be something wrong with my paths or configuration, but I don't have the first idea where to start debugging Tiles to determine what it is looking for, or why something isn't being found. I tried putting breakpoints on every public method in TilesView, but nothing is every called when I try to access a page.
webmvc-config.xml:
<!-- Tiles page resolver -->
<bean id="viewResolver" class="org.springframework.web.servlet.view.tiles3.TilesViewResolver" >
<property name="viewClass" value="org.springframework.web.servlet.view.tiles3.TilesView" />
</bean>
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
<property name="definitions">
<value>/WEB-INF/tiles.xml</value>
</property>
</bean>
/WEB-INF/tiles.xml:
<?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">
<tiles-definitions>
<definition name="secure/login" template="/WEB-INF/views/tiles/layouts/default.jsp">
<put-attribute name="body" value="/WEB-INF/views/tiles/secure/login/body.jsp"/>
</definition>
</tiles-definitions>
And I can confirm that the files /WEB-INF/views/tiles/layouts/default.jsp and /WEB-INF/views/tiles/secure/login/body.jsp exist.
I am hoping for an error message, or something at least, in the log output so I can start to figure this out, but I don't get anything at all. The only thing I see that is tiles related in the output log is:
2013-10-25 13:55:05,034 [localhost-startStop-1] INFO web.servlet.view.tiles3.TilesConfigurer - Found JSP 2.1 ExpressionFactory
2013-10-25 13:55:05,082 [localhost-startStop-1] INFO org.apache.tiles.access.TilesAccess - Publishing TilesContext for context: org.springframework.web.servlet.view.tiles3.SpringWildcardServletTilesApplicationContext
Where/how do I start?
I should add that I currently had the application working with Tiles2 successfully, and was trying to upgrade to Tiles3 but am having no luck.
The controller looks like:
SecureController.java
@RequestMapping("/secure/**")
@Controller
public class SecureController {
@RequestMapping(value = "/login", method = RequestMethod.GET)
public String login(ModelMap model) {
return "secure/login";
}
}
And I can confirm that the "return secure/login" statement is being executed.
log4j.xml:
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
<appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ISO8601} [%t] %-5p %c{5} - %m%n" />
</layout>
</appender>
<!-- Some other loggers here too -->
<!-- Apache Tiles -->
<logger name="org.apache.tiles">
<level value="TRACE" />
</logger>
<root>
<level value="INFO" />
<appender-ref ref="STDOUT" />
</root>
</log4j:configuration>
pom.xml snippet:
<!-- Apache Tiles -->
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-extras</artifactId>
<version>3.0.1</version>
</dependency>
URL being accessed: //localhost:8080/myapp/secure/login